开发者

Howto override listener in gridpanel on ExtJS4

开发者 https://www.devze.com 2023-04-12 02:25 出处:网络
Hii howto override itemclick in gridpanel on ExtJS4 ? I have gridpanel with alias tableA like this : Ext.define(\'AM.test.TableA\', {

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.


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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号