Roo/form/ComboBoxArray.js
[roojs1] / Roo / form / ComboBoxArray.js
index 68fdf1e..3ed2959 100644 (file)
@@ -269,15 +269,42 @@ Roo.extend(Roo.form.ComboBoxArray, Roo.form.TextField,
     {
          
         
-        var _this = this;
-        Roo.each(v, function(l) {
-            _this.addItem(l);
-        });
+        if (this.store.isLocal) {
+            // then we can use the store to find the values..
+            // comma seperated at present.. this needs to allow JSON based encoding..
+            this.hiddenEl.value  = v;
+            var v_ar = [];
+            Roo.each(v.split(','), function(k) {
+                Roo.log("CHECK " + this.valueField + ',' + k);
+                var li = this.store.query(this.valueField, k);
+                if (!li.length) {
+                    return;
+                }
+                add = {};
+                add[this.valueField] = k;
+                add[this.displayField] = li.item(0).data[this.displayField];
+                
+                this.addItem(add);
+            }, this) 
+            
+                
+            
+        }
+        
         
     },
     setFromData: function(v)
     {
-        Roo.log(v);
+        // this recieves an object, if setValues is called.
+        var keys = v[this.valueField].split(',');
+        var display = v[this.displayField].split(',');
+        for (var i = 0 ; i < keys.length; i++) {
+            
+            add = {};
+            add[this.valueField] = keys[i];
+            add[this.displayField] = values[i];
+                
+        }
       
         
     },