Howto override listener in gridpanel on ExtJS4
Asked Answered
M

1

1

Hii howto override itemclick in gridpanel on ExtJS4 ? I have gridpanel with alias tableA like this :

Ext.define('AM.test.TableA', {
    extend: 'Ext.grid.Panel',
    alias: 'widget.tableA',

    initComponent: function() {
        // tableA configurations
        this.callParent(arguments);
    }
});

And my tableA controller like this :

Ext.define('AM.test.TableAController', {
       extend: 'Ext.app.Controller',

       init: function() {
            this.control({
               'tableA': {
                   itemclick: this.tableSelection
                }
            });
       },
       tableSelection: function(grid, record) {
            console.log('tableA selection');
       }
} 

With this configuration, when i click some row in tableA i get message "tableA selection" in console. Then, i want to extends tableA to tableB like this:

Ext.define('AM.test.TableB', {
    extend: 'AM.test.TableA',
    alias: 'widget.tableB'
});

And my tableB controller look like this :

Ext.define('AM.test.TableBController', {
    extend: 'Ext.app.Controller',

    init: function() {
        this.control({
           'tableB': {
               itemclick: this.tableBSelection
           }
        });
    },
    tableBSelection: function(grid, record) {
          console.log('tableB selection');
    }
}

With this, when i click some row in tableB. I get message 'tableB selection' and then 'tableA selection' like this in my console dialog:

tableB selection
tableA selection

Btw, what must i do to override itemclick from 'tableA' in 'tableB' ? I don't want to call 'itemclick' on tableA.

Madisonmadlen answered 11/10, 2011 at 18:16 Comment(0)
M
3

Try using stopPropogation on B to stop the bubbling of the itemclick event http://docs.sencha.com/ext-js/4-0/#!/api/Ext.EventObject-method-stopPropagation

Melosa answered 12/10, 2011 at 5:20 Comment(1)
Btw where i must define stopPropagation method on B ? On 'tableB' or on 'TableBController' ?Madisonmadlen

© 2022 - 2024 — McMap. All rights reserved.