Wondering how others are handling situations where you'd like to know if the value of a Model's field changes?
One solution is to override the Model's afterEdit method.
PHP Code:
afterEdit: function() {
var me = this;
Ext.Object.each(me.modified, function(key, oldValue, self) {
if(oldValue) {
me.fireEvent(key+'modified', me, me.get(key), oldValue);
}
});
this.callParent(arguments);
}
Here's another solution that leverages the store's 'update' event which is fired in the model's afterEdit method.
PHP Code:
listeners: {
update: function(store, record, modelOperation) {
if(modelOperation === 'edit') {
Ext.Object.each(record.modified, function(key, oldValue, self) {
if(oldValue) {
record.fireEvent(key+'modified', me, me.get(key), oldValue);
}
});
}
},
With either approach I can setup listeners for fieldnamemodified events on the model. Its not bad but it seems Ext.data.Field should have an event like this.