Ext Toolbar项列表器在溢出菜单中不起作用



我有一个Ext.toolbar.toolbar,它有几个按钮,还有一个控制器,它可以监听这些按钮的点击事件,比如这个

    control({    
          '#button1id': {
             click: this.handler1
           } 
    });

问题是enableOverflow在工具栏中设置为true,每当出现溢出时,成为溢出菜单一部分的按钮-它们的id甚至itemid都会更改,因此控制器侦听器无法工作。。。。。对此最好的解决方案是什么?

如果您知道按钮可能会溢出,请尝试不使用id。使用其他一些自定义选项,如:

{
    xtype: 'button',
    action: 'foo', // custom option
    text: 'whatever'
}

然后像这样设置你的控制器:

control({    
    '[action=foo]': {
         click: this.handler1
    } 
});

最新更新