Roo/form/ComboNested.js
authorAlan Knowles <alan@roojs.com>
Mon, 10 Feb 2020 07:07:31 +0000 (15:07 +0800)
committerAlan Knowles <alan@roojs.com>
Mon, 10 Feb 2020 07:07:31 +0000 (15:07 +0800)
Roo/form/ComboNested.js

index 6549e8e..db50667 100644 (file)
@@ -338,28 +338,58 @@ 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;
+        if(store.getCount() < 1){
+            return false;
+        }
+        store.each(function(r){
+             if(r.data[prop] == value){
+                 record = 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;
                 }
-                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;
+        });
+        
         return record;
     },
     
-    function selectActive()
+    
+    
+    selectActive : function (lvl)
+    {
+        // just need to determine which of the current level is selected if any..
+        var value = this.getValue();
+        var prop = this.hiddenName;
+        var store = this.stores[lvl];
+        if(store.getCount() < 1){
+            return;
+        }
+        store.each(function(r){
+            if(r.data[prop] == value){
+                 record = 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;
+        });
+        
+    }