Threaded View

  1. #1
    Ext JS Premium Member
    Join Date
    Mar 2009
    Location
    San Mateo, CA
    Posts
    32
    Vote Rating
    3
    bergstyle is on a distinguished road

      1  

    Default Model Field Value Change Event

    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() {
            var 
    me this;
            
    Ext.Object.each(me.modified, function(keyoldValueself) {
                if(
    oldValue) {    
                    
    me.fireEvent(key+'modified'meme.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(storerecordmodelOperation) {
                if(
    modelOperation === 'edit') {
                    
    Ext.Object.each(record.modified, function(keyoldValueself) {
                        if(
    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 Ext.data.Field 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

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar