PDA

View Full Version : [FIXED] [4.2.1] RowEditor onFieldChange never fires



tbonci
19 Nov 2013, 9:19 AM
In 4.1.3, Ext.grid.RowEditor's onFieldChange method gets added to each field's change listener. In 4.2.1, the method exists, but is never added. This causes any field validation to keep the update button of RowEditing from enabling and keeps the error summary from being updated.

Easily fixed with the following override.

Ext.override(Ext.grid.RowEditor, {
addFieldsForColumn: function(column, initial) {
var me = this,
i,
length, field;
if (Ext.isArray(column)) {
for (i = 0, length = column.length; i < length; i++) {
me.addFieldsForColumn(column[i], initial);
}
return;
}
if (column.getEditor) {
// Get a default display field if necessary
field = column.getEditor(null, {
xtype: 'displayfield',
// Override Field's implementation so that the default display fields will not return values. This is done because
// the display field will pick up column renderers from the grid.
getModelData: function() {
return null;
}
});
if (column.align === 'right') {
field.fieldStyle = 'text-align:right';
}
if (column.xtype === 'actioncolumn') {
field.fieldCls += ' ' + Ext.baseCSSPrefix + 'form-action-col-field'
}
//Adding onfield change
me.mon(field, 'change', me.onFieldChange, me);
if (me.isVisible() && me.context) {
if (field.is('displayfield')) {
me.renderColumnData(field, me.context.record, column);
} else {
field.suspendEvents();
field.setValue(me.context.record.get(column.dataIndex));
field.resumeEvents();
}
}
if (column.hidden) {
me.onColumnHide(column);
} else if (column.rendered && !initial) {
// Setting after initial render
me.onColumnShow(column);
}
}
}
});

evant
19 Nov 2013, 12:52 PM
Thanks the post, this issue is already resolved in 4.2.2.