Roo/form/ComboNested.js
[roojs1] / roojs-ui-debug.js
index abb0bf8..b3c69c4 100644 (file)
@@ -20501,7 +20501,6 @@ Roo.extend(Roo.form.ComboNested, Roo.form.ComboBox, {
         var ix = view.getSelectedIndexes();
          
         if (opts.list > this.maxColumns - 2) {
-             
             this.setFromData(ix.length ? view.store.getAt(ix[0]).data : {});
             return;
         }
@@ -20533,8 +20532,7 @@ Roo.extend(Roo.form.ComboNested, Roo.form.ComboBox, {
         if (this.isLoading) {
             this.selectActive(opts.list);
         }
-        
-        
+         
     },
     onDoubleClick : function()
     {
@@ -20543,13 +20541,10 @@ Roo.extend(Roo.form.ComboNested, Roo.form.ComboBox, {
     
      
     
-    findRecord : function (prop,value)
-    {
-        return this.findRecordInStore(this.store, prop,value);
-    },
+    
     
     // private
-    findRecordInStore : function(store, prop, value)
+    recordToStores : function(store, prop, value, stack)
     {
         var cstore = new Roo.data.SimpleStore({
             //fields : this.store.reader.meta.fields, // we need array reader.. for
@@ -20558,28 +20553,51 @@ Roo.extend(Roo.form.ComboNested, Roo.form.ComboBox, {
         });
         var _this = this;
         var record  = false;
-        if(store.getCount() > 0){
-           store.each(function(r){
-                if(r.data[prop] == value){
-                    record = r;
+       var srec = false;
+        if(store.getCount() < 1){
+            return false;
+        }
+        store.each(function(r){
+            if(r.data[prop] == value){
+                record = r;
+               srec = r;
+                return false;
+            }
+            if (r.data.cn && r.data.cn.length) {
+                cstore.loadDataFromChildren( r);
+                var cret = _this.recordToStores(cstore, prop, value, stack);
+                if (cret !== false) {
+                    record = cret;
+                   srec = r;
                     return false;
                 }
-                if (r.data.cn && r.data.cn.length) {
-                    cstore.loadDataFromChildren( r);
-                    var cret = _this.findRecordInStore(cstore, prop, value);
-                    if (cret !== false) {
-                        record = cret;
-                        return false;
-                    }
-                }
-                
-                return true;
-            });
-        }
+            }
+             
+            return true;
+        });
+        if (record == false) {
+           return false
+       }
+       stack.unshift(srec);
         return record;
     },
     
-    function selectActive()
+    /*
+     * find the stack of stores that match our value.
+     *
+     * 
+     */
+    
+    selectActive : function ()
+    {
+       // if store is not loaded, then we will need to wait for that to happen first.
+        var stack = [];
+       this.findRecordInStore(this.store, this.hiddenName, this.getValue(), stack);
+       
+       
+    }
+       
+