Events 处理按钮上的tapStart事件
我有一个带旋转木马的应用程序。在所有转盘页面上都有按钮和日期选择器等元素。我想使用Sencha Touch处理这些元素中的每个元素的tapStart事件,但我还没有找到任何允许我这样做的东西 有人有主意吗 更新Events 处理按钮上的tapStart事件,events,extjs,sencha-touch,sencha-touch-2,tap,Events,Extjs,Sencha Touch,Sencha Touch 2,Tap,我有一个带旋转木马的应用程序。在所有转盘页面上都有按钮和日期选择器等元素。我想使用Sencha Touch处理这些元素中的每个元素的tapStart事件,但我还没有找到任何允许我这样做的东西 有人有主意吗 更新 我在Sencha论坛上也问了这个问题。这里是Sencha论坛线程的链接:您可以尝试使用它,它可以绑定到任何元素,包括按钮在Sencha Touch论坛的帮助下,我找到了解决问题的方法 首先,我使用initConfig函数初始化容器的配置 Ext.define('MyApp.view.Vi
我在Sencha论坛上也问了这个问题。这里是Sencha论坛线程的链接:您可以尝试使用它,它可以绑定到任何元素,包括按钮在Sencha Touch论坛的帮助下,我找到了解决问题的方法 首先,我使用
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
}
});
到目前为止你有什么代码?@ChrisBain这是我的问题,事实上,我真的没有任何代码。我所拥有的只是一个转盘,转盘中的每个容器上都有各种元素。