将OnTap添加到TitleBar

时间:2013-05-23 15:02:20

标签: sencha-touch-2 sencha-architect

当点击食物标题栏时,我需要能够隐藏网格(食物标题栏下面的内容)。

从我发现我必须使用事件委派,但出于某种原因,当我点击Food TitleBar时,我使用Alert()的测试没有做任何事情。

有人能帮助我吗? (使用架构师,所以我更容易使用架构师来获得解决方案,因为生成的大多数代码都是ReadOnly -_-')

http://img844.imageshack.us/img844/5809/capturedecran20130523a1.png

1 个答案:

答案 0 :(得分:1)

我只使用过一次建筑师。但我很确定有一个界面来编辑它生成的代码。 Here is the demo to implement a click on the titlebar

Ext.Loader.setConfig({
    enabled: true
});

Ext.application({
    name: ('SF' || 'SenchaFiddle'),

    launch: function () {
        Ext.define('MyApp.view.home', {
            extend: 'Ext.Container',
            xtype: 'homecontainer',
            config: {
                items: [{
                    xtype: 'toolbar',
                    title: 'test',
                    dock: 'top',
                    listeners: {
                        painted: function (element, opt) {
                            element.on('tap', function () {
                                alert('Test');
                            });
                        }
                    }
                }]
            }
        });

        Ext.Viewport.add(Ext.create('MyApp.view.home'));
    }
});
相关问题