0
votes

I have a window include a combo like

       items: {
            xtype: 'form',
            items: {
                xtype: 'combo',
                id: 'combo',
                queryMode: 'local',                
                displayField: 'name',
                valueField: 'id',
                store: Ext.create('Ext.data.Store', {
                    fields: ['id', 'name'],
                    data: [
                      {'id': '1', 'name': 'John Smith'},
                      {'id': '2', 'name': 'Albert Einstein'}
                    ]
                }),
                listeners: {
                    change: function( combo, newValue, oldValue, eOpts ) {
                        alert('reset fire 1');
                    },
                    dirtychange:function( combo, isDirty, eOpts ) {
                        alert('reset fire 2');
                    },
                   select: function( combo, records, eOpts ) {
                        alert('reset fire 3');
                   }
                }
            }
        }

I'm looking for a event inside a combo When i call reset form that will fire. Is that possible? here is my code http://jsfiddle.net/KVrZ7/

1
don't forget to accept answers please. - dbrin

1 Answers

1
votes

"Change" event is not bad:

listeners: {
   change: function(field, val) {
       if(!val) {
           alert('reset');
       }
   }
}

See: http://jsfiddle.net/KVrZ7/2/

Another solution - you can fire "reset" event in your form (or field). In your button:

handler: function() {
    window.down('form').getForm().reset();
    window.down('form').fireEvent('reset'); //<--------- firing event
}

And in your combo:

listeners: {
    afterrender: function(f) {
        f.up('form').on('reset', function() {//<----- getting a form and attach handler
            alert('reset');
        });
    }
}

See: http://jsfiddle.net/KVrZ7/4/