Mar 11, 2014, 5:04 AM
[CLOSED] TagField not clearing tagLabels on empty values and array values.
Hi there
I've had some issues with the TagField on a FormPanel when performing a loadRecord() or an updateRecord(). When a record has an empty array or string value, the TagField does not clear the tagLabels to reflect the empty value.
Additionally, it does not return an array during an updateRecord() on the FormPanel, although this might be by design.
The following is the current override I'm using to address the issue.
I've had some issues with the TagField on a FormPanel when performing a loadRecord() or an updateRecord(). When a record has an empty array or string value, the TagField does not clear the tagLabels to reflect the empty value.
Additionally, it does not return an array during an updateRecord() on the FormPanel, although this might be by design.
The following is the current override I'm using to address the issue.
Ext.override(Ext.net.TagField, {
getValue: function () {
var delimeter = this.getDelimeter();
var state = [];
Ext.each(this.value, function (obj) {
state.push(obj.value);
}, this);
// Check for an empty delimeter and return an array instead of a joined string.
return delimeter === false || delimeter === "" ? state : state.join(delimeter);
},
setValue: function (value, opts) {
var me = this;
// Fix for empty values not being cleared
value = this.convertValue(value);
if (value && value.length == 0 && this.tagLabel)
this.tagLabel.removeAll();
me.callParent(arguments);
}
});
Cheers Peter
Last edited by Daniil; Mar 13, 2014 at 3:30 PM.
Reason: [CLOSED]