Procházet zdrojové kódy

combotree 异步刷新问题

luoyifan před 3 roky
rodič
revize
0cdf7cd034
2 změnil soubory, kde provedl 17 přidání a 4 odebrání
  1. 15 2
      src/controls/treepicker.js
  2. 2 2
      src/init.ts

+ 15 - 2
src/controls/treepicker.js

@@ -34,6 +34,15 @@ export default function () {
             this.store = store
             const me = this;
             if (me.store) {
+                if (me.picker) {
+                    me.picker.setStore(store)
+                    if (me.isExpanded) {
+                        me.collapse()
+                        delete me.picker
+                        me.expand()
+                    }
+                }
+                this.onLoad()
                 me.mon(me.store, {
                     scope: me,
                     load: me.onLoad,
@@ -58,6 +67,7 @@ export default function () {
                     minWidth: me.minPickerWidth,
                     manageHeight: false,
                     shadow: false,
+                    scrollable: true,
                     listeners: {
                         scope: me,
                         itemclick: me.onItemClick,
@@ -158,7 +168,7 @@ export default function () {
         },
 
         onLoad() {
-            var value = this.value;
+            const value = this.value;
 
             if (value) {
                 this.setValue(value);
@@ -166,11 +176,14 @@ export default function () {
         },
 
         onUpdate(store, rec, type, modifiedFieldNames) {
-            var display = this.displayField;
+            const display = this.displayField;
+            const me = this
 
             if (type === 'edit' && modifiedFieldNames &&
                 Ext.Array.contains(modifiedFieldNames, display) &&
                 this.value === rec.getId()) {
+
+                me.mixins.field.setValue.call(me, this.value);
                 this.setRawValue(rec.get(display));
             }
         }

+ 2 - 2
src/init.ts

@@ -18,7 +18,7 @@ import initRows from './controls/rows'
 import initCols from './controls/cols'
 import initButton from './controls/button'
 import initStores from './controls/stores'
-import initTreepicker from './controls/treepicker'
+import initCombotree from './controls/combotree'
 import {lookupFn, lookupScope} from "./lib/lib"
 import * as SystemLib from './lib/systemLib'
 import './lib/fix'
@@ -123,5 +123,5 @@ export function init() {
     initCheckboxGroup()
     initRadio()
     initRadioGroup()
-    initTreepicker()
+    initCombotree()
 }