Roo/form/ComboNested.js
authorAlan Knowles <alan@roojs.com>
Thu, 6 Feb 2020 08:07:37 +0000 (16:07 +0800)
committerAlan Knowles <alan@roojs.com>
Thu, 6 Feb 2020 08:07:37 +0000 (16:07 +0800)
Roo/form/ComboNested.js

index 769d673..26ed1bc 100644 (file)
@@ -41,7 +41,7 @@ Roo.form.ComboNested = function(config){
             throw "Roo.form.ComboNested : missing value for: " + e;
         }
     });
-    
+    this.setStore(this.store);
     
 };
 
@@ -224,6 +224,46 @@ Roo.extend(Roo.form.ComboNested, Roo.form.ComboBox, {
         
         
     },
+      /**
+     * Changes the data store this view uses and refresh the view.
+     * @param {Store} store
+     */
+    setStore : function(store, initial){
+        if(!initial && this.store){
+            this.store.un("datachanged",    this.storeRefresh);
+            this.store.un("add",            this.storeOnAdd);
+            this.store.un("remove",         this.storeOnRemove);
+            this.store.un("update",         this.storeOnUpdate);
+            this.store.un("clear",          this.storeRefresh);
+            this.store.un("beforeload",     this.storeOnBeforeLoad);
+            this.store.un("load",           this.storeOnLoad);
+            this.store.un("loadexception",  this.storeOnLoad);
+        }
+        if(store){
+          
+            store.on("datachanged",     this.storerefresh, this);
+            store.on("add",             this.storeOnAdd, this);
+            store.on("remove",          this.storeOnRemove, this);
+            store.on("update",          this.storeOnUpdate, this);
+            store.on("clear",           this.storeRefresh, this);
+            store.on("beforeload",      this.storeOnBeforeLoad, this);
+            store.on("load",            this.storeOnLoad, this);
+            store.on("loadexception",   this.storeOnLoad, this);
+        }
+        
+        if(store){
+            this.storeRefresh();
+        }
+    },
+    
+    
+    
+    
+    
+    
+    
+    
+    
     
     
 });
\ No newline at end of file