Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/extjs/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Events 处理按钮上的tapStart事件_Events_Extjs_Sencha Touch_Sencha Touch 2_Tap - Fatal编程技术网

Events 处理按钮上的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 Touch处理这些元素中的每个元素的tapStart事件,但我还没有找到任何允许我这样做的东西

有人有主意吗

更新


我在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这是我的问题,事实上,我真的没有任何代码。我所拥有的只是一个转盘,转盘中的每个容器上都有各种元素。