Sencha touch 2 在控制器中引用容器的子项
如何在Sencha Touch 2控制器中通过itemId引用容器的子项?例如,一个xtype为“mypanel”的容器,它包含一个itemId为“mybutton”的按钮。在控制器中,我想为按钮分配一个偶数处理程序。我该怎么做 我的应用程序相当大,通常有一个组件的副本,所以我在应用程序中的任何地方都不使用id,而是使用itemIdSencha touch 2 在控制器中引用容器的子项,sencha-touch-2,Sencha Touch 2,如何在Sencha Touch 2控制器中通过itemId引用容器的子项?例如,一个xtype为“mypanel”的容器,它包含一个itemId为“mybutton”的按钮。在控制器中,我想为按钮分配一个偶数处理程序。我该怎么做 我的应用程序相当大,通常有一个组件的副本,所以我在应用程序中的任何地方都不使用id,而是使用itemId Ext.define('myapp.controller.Test', { extend: 'Ext.app.Controller', confi
Ext.define('myapp.controller.Test', {
extend: 'Ext.app.Controller',
config: {
control: {
myButton: {
tap: 'showView'
}
},
refs: {
myPanel: 'mypanel',
myButton: '?'
}
},
showView: function(){
}
});
有关ComponentQuery的更多信息,请参见此处:当使用itemId而不是id时,您还需要在控制器的ref中提及包含itemId元素的父元素,如下所示:
refs: {
mybutton: 'xtype_of_panel #itemId_button'
//where 'itemId_button' is the itemId and 'xtype_of_panel' is the parent that contains the element with the itemId of 'itemId_button'
}
refs: {
mybutton: 'xtype_of_panel #itemId_button'
//where 'itemId_button' is the itemId and 'xtype_of_panel' is the parent that contains the element with the itemId of 'itemId_button'
}