X-Git-Url: http://git.roojs.org/?a=blobdiff_plain;f=Roo%2Fform%2FComboBoxArray.js;h=9119ab061af7d76cd758db5c421636a6a7b0b34b;hb=66be5b8062e40f71e990833b11f7c695754096cc;hp=30595e62c6d50ad106e6573975889fb2f1616d20;hpb=53a5902a6259ad333b1cf38359821c4849b012c5;p=roojs1 diff --git a/Roo/form/ComboBoxArray.js b/Roo/form/ComboBoxArray.js index 30595e62c6..9119ab061a 100644 --- a/Roo/form/ComboBoxArray.js +++ b/Roo/form/ComboBoxArray.js @@ -102,6 +102,11 @@ Roo.extend(Roo.form.ComboBoxArray, Roo.form.TextField, this.combo = Roo.factory(this.combo, Roo.form); this.combo.onRender(ct, position); + // assigned so form know we need to do this.. + this.store = this.combo.store; + this.valueField = this.combo.valueField; + this.displayField = this.combo.displayField ; + this.combo.wrap.addClass('x-cbarray-grp'); @@ -262,15 +267,39 @@ Roo.extend(Roo.form.ComboBoxArray, Roo.form.TextField, }, setValue: function(v) // not a valid action - must use addItems.. { - if (typeof(v) != 'object') { - return; + + + 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.hiddenField.el.value = v; + var v_ar = []; + Roo.each(v.split(','), function(k) { + var li = this.store.query(this.store.valueField, k); + if (!li.length) { + return; + } + add = {}; + add[this.store.valueField] = k; + add[this.store.displayField] = li.item(0).data[this.store.displayField]; + + this.addItem(add); + }, this) + + + } - var _this = this; - Roo.each(v, function(l) { - _this.addItem(l); - }); + }, + setFromData: function(v) + { + Roo.log(v); + + + }, + + validateValue : function(value){ return Roo.form.ComboBoxArray.superclass.validateValue.call(this, this.getValue());