One of great things about Ext JS data Stores is change management. Our applications might attack changing Records in a variety of ways, from editable data Grids
to simple Forms
, but making changes really only means something when we act on it. We might only change our display, but we are more than likely to send changes back to the server.
One of the easiest things to do is to apply an update
event listener to our Store
object. We've applied two other listeners in the past: the beforeload
and load
listeners. Now, let's apply an update listener to our script.
listeners:{ beforeload:{ fn: function(store, options){ for(var i in options){ if(options[i].length > 0){ store.baseParams[i] = options[i]; } } }, scope:this }, load: { fn: function(store, records, options){ console.log(records); }, scope: this }, update: { fn: function(store, record, operation){ switch (operation){ case Ext.record.EDIT: // Do something with the edited record break; case Ext...