X-Git-Url: http://git.roojs.org/?a=blobdiff_plain;f=Roo%2Fform%2FComboBoxArray.js;h=74a02899fb207182ec6ec387890eaa4b9ec4c9bb;hb=4c028cc735ffaaa41aeaf05ea70dc4810513397d;hp=41635c8554ab048edc9c008ea5ac3ccd686b93e0;hpb=f1bfe6e01dd8390939ede2454f631e7ca5480b68;p=roojs1 diff --git a/Roo/form/ComboBoxArray.js b/Roo/form/ComboBoxArray.js index 41635c8554..74a02899fb 100644 --- a/Roo/form/ComboBoxArray.js +++ b/Roo/form/ComboBoxArray.js @@ -36,6 +36,16 @@ Roo.form.ComboBoxArray = function(config) { + this.addEvents({ + /** + * @event remove + * Fires when remove the value from the list + * @param {Roo.form.ComboBox} combo This combo box + */ + 'remove' : true + + + }); Roo.form.ComboBoxArray.superclass.constructor.call(this, config); @@ -335,10 +345,46 @@ Roo.extend(Roo.form.ComboBoxArray, Roo.form.TextField, }, + /** + * Validates the combox array value + * @return {Boolean} True if the value is valid, else false + */ + validate : function(){ + if(this.disabled || this.validateValue(this.processValue(this.getValue()))){ + this.clearInvalid(); + return true; + } + return false; + }, validateValue : function(value){ return Roo.form.ComboBoxArray.superclass.validateValue.call(this, this.getValue()); + }, + + /*@ + * overide + * + */ + isDirty : function() { + if(this.disabled) { + return false; + } + + try { + var d = Roo.decode(String(this.originalValue)); + } catch (e) { + return String(this.getValue()) !== String(this.originalValue); + } + + var originalValue = []; + + for (var i = 0; i < d.length; i++){ + originalValue.push(d[i][this.valueField]); + } + + return String(this.getValue()) !== String(originalValue.join(',')); + } }); @@ -411,11 +457,13 @@ Roo.extend(Roo.form.ComboBoxArray.Item, Roo.BoxComponent, { remove : function() { - + Roo.log(this); this.cb.items.remove(this); this.el.child('img').un('click', this.remove, this); this.el.remove(); this.cb.updateHiddenEl(); + + Roo.log('remove?????'); + this.cb.fireEvent('remove', this.cb, this); } - }); \ No newline at end of file