Howto override listener in gridpanel on ExtJS4

六月ゝ 毕业季﹏ 提交于 2019-12-11 13:11:29

问题


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.


回答1:


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



来源:https://stackoverflow.com/questions/7730552/howto-override-listener-in-gridpanel-on-extjs4

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!