extjs中的itemid重复问题 [英] itemid repeatation problem in extjs

查看:203
本文介绍了extjs中的itemid重复问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果你可以重复itemId属性的值,那么controlQuery如何知道应该处理哪个项目?



例如。



因此,如果我们有button1,那么每次按下button1时都会触发该事件,无论它是在panel1,panel2还是panel3中。

解决方案

< blockquote>事件可以在控制器级别添加



 init: function (){
this .control({
' button [itemId = testButton]':{
click: this .OnClickTestButton
});
this .callParent(arguments);
},
OnClickTestButton: function (btn){
}





示例可以在下面的链接中找到。

http://docs-origin.sencha.com/extjs/4.2.1/#!/api/Ext.app.Controller-method-control [ ^ ]

If you can repeat the value of the itemId property, then how is controlQuery know which item is supposed handle?

eg.

So if we have button1, then the event should trigger everytime button1 is pressed no matter if its in panel1, panel2 or panel3.

解决方案

The event can be added at the controller level

init: function () {
        this.control({
            'button[itemId=testButton]': {
                click: this.OnClickTestButton
                    });
        this.callParent(arguments);
    },
OnClickTestButton: function (btn) {
}



Example can be found in below link.
http://docs-origin.sencha.com/extjs/4.2.1/#!/api/Ext.app.Controller-method-control[^]


这篇关于extjs中的itemid重复问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆