开发者

Sencha Touch Tab Handlers

I'm trying to do a Tabpanel in Sencha Touch and add a handler to one of the buttons, but the event doesn't fire when I click it. Any ideas?

Here is the code:

The handler:

var handler = functio开发者_如何学编程n(button, event) {
        var txt = "YES!";
        alert(txt);
    };

And the item:

items: [{
        xtype: 'button',
        title: 'Test',
        html: 'Test',
        iconCls: 'info',
        cls: 'card1',
        handler: handler
    }]


Add after items:

listeners: {
        cardswitch : function() {
          console.log('cardswitch!');
        }
}

See docs http://dev.sencha.com/deploy/touch/docs/?class=Ext.TabBar


For your specific case, if you want your event to be triggered only in the case of one tab, you can listen for the activate event of that tab:

items: [{
        xtype: 'button',
        title: 'Test',
        html: 'Test',
        iconCls: 'info',
        cls: 'card1',
        listeners: {
            activate : function() {alert("bam!")}
        }
    }]
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜