X-Git-Url: http://git.roojs.org/?p=roojs1;a=blobdiff_plain;f=docs%2Fsrc%2FRoo_form_ComboBoxArray.js.html;h=3eaf9911e88e15d8d3731845c177a8ae49af7d9a;hp=0d46893de017e96740c92dd331383a0a0b2ad177;hb=0b69a11b1055a6d3a3fd0719bdd58b5a235de0e4;hpb=71ba0d6217135dfbf45c3c36f69cec6a293e5fa5 diff --git a/docs/src/Roo_form_ComboBoxArray.js.html b/docs/src/Roo_form_ComboBoxArray.js.html index 0d46893de0..3eaf9911e8 100644 --- a/docs/src/Roo_form_ComboBoxArray.js.html +++ b/docs/src/Roo_form_ComboBoxArray.js.html @@ -1,4 +1,4 @@ -/home/edward/gitlive/roojs1/Roo/form/ComboBoxArray.js/* +Roo/form/ComboBoxArray.js/* * Copyright(c) 2010-2012, Roo J Solutions Limited * * Licence LGPL @@ -94,7 +94,10 @@ * @cfg {String} hiddenName The hidden name of the field, often contains an comma seperated list of names */ hiddenName : false, - + /** + * @cfg {String} seperator The value seperator normally ',' + */ + seperator : ',', // private the array of items that are displayed.. items : false, @@ -115,7 +118,7 @@ // give fake names to child combo; this.combo.hiddenName = this.hiddenName ? (this.hiddenName+'-subcombo') : this.hiddenName; - this.combo.name = this.name? (this.name+'-subcombo') : this.name; + this.combo.name = this.name ? (this.name+'-subcombo') : this.name; this.combo = Roo.factory(this.combo, Roo.form); this.combo.onRender(ct, position); @@ -236,6 +239,7 @@ { var valueField = this.combo.valueField; var displayField = this.combo.displayField; + if (this.items.indexOfKey(rec[valueField]) > -1) { //console.log("GOT " + rec.data.id); return; @@ -267,9 +271,8 @@ this.items.each(function(f) { ar.push(f.data[idField]); - }); - this.hiddenEl.dom.value = ar.join(','); + this.hiddenEl.dom.value = ar.join(this.seperator); this.validate(); }, @@ -296,14 +299,12 @@ this.reset(); - - if (this.store.isLocal && (typeof(v) == 'string')) { // 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.each(v.split(this.seperator), function(k) { Roo.log("CHECK " + this.valueField + ',' + k); var li = this.store.query(this.valueField, k); if (!li.length) { @@ -320,7 +321,13 @@ if (typeof(v) == 'object' ) { // then let's assume it's an array of objects.. Roo.each(v, function(l) { - this.addItem(l); + var add = l; + if (typeof(l) == 'string') { + add = {}; + add[this.valueField] = l; + add[this.displayField] = l + } + this.addItem(add); }, this); } @@ -342,10 +349,9 @@ dv = typeof(dv) != 'string' ? '' : dv; - var keys = kv.split(','); - var display = dv.split(','); + var keys = kv.split(this.seperator); + var display = dv.split(this.seperator); for (var i = 0 ; i < keys.length; i++) { - add = {}; add[this.valueField] = keys[i]; add[this.displayField] = display[i]; @@ -393,7 +399,7 @@ originalValue.push(d[i][this.valueField]); } - return String(this.getValue()) !== String(originalValue.join(',')); + return String(this.getValue()) !== String(originalValue.join(this.seperator)); }