我想出了一个解决我的问题从煎茶触摸论坛上寻求帮助的任何元素。
首先我使用initConfig
函数初始化我的容器配置。
Ext.define('MyApp.view.ViewName', {
...
// Very Important, this is what I use in the controller to handle the events
xtype: 'myxtype',
...
initConfig: function() {
var me = this;
this.config = {
...
items: {
...
{
xtype: 'button',
...
listeners: {
element: 'element',
// This is where my code handles the tapstart
// (touchstart) event
touchstart: function() {
// Fire an event on the controller (me)
me.fireEvent('buttondown');
}
}
},
...
}
}
this.callParent([this.config]); // Very Important when using initConfig
}
});
然后,在我的控制,我添加以下代码:
Ext.define('MyApp.controller.MainController', {
...
config: {
views: [
'ViewName',
...
],
...
},
...
init: function() {
this.control({
'myxtype': {
buttondown: this.myFunction
}
})
},
myFunction: function() {
// Do something
}
});
你有什么代码这么远? – Chris 2013-05-02 22:12:06
@ChrisBain这是我的问题其实,我真的没有任何代码。我所有的是在旋转木马的每个容器上都有各种元素的旋转木马。 – 2013-05-03 01:12:15