Results 1 to 3 of 3

Thread: Model Field Value Change Event

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Ext JS Premium Member
    Join Date
    Mar 2009
    San Mateo, CA
    Vote Rating

    Default Model Field Value Change Event

    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() {
    me this;
    Ext.Object.each(me.modified, function(keyoldValueself) {
    oldValue) {    
    me.fireEvent(key+'modified'meme.get(key), oldValue);
    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(storerecordmodelOperation) {
    modelOperation === 'edit') {
    Ext.Object.each(record.modified, function(keyoldValueself) {
    oldValue) {    
    record.fireEvent(key+'modified'meme.get(key), oldValue);
    With either approach I can setup listeners for fieldnamemodified events on the model. Its not bad but it seems should have an event like this.
    Last edited by bergstyle; 29 Jun 2011 at 9:24 PM. Reason: added if(oldValue) to prevent firing extraneous events

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts