3

Sencha TouchでTabpanelを実行し、ボタンの1つにハンドラーを追加しようとしていますが、クリックしてもイベントが発生しません。何か案は?

コードは次のとおりです。

ハンドラー:

var handler = function(button, event) {
        var txt = "YES!";
        alert(txt);
    };

そしてアイテム:

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

2 に答える 2

7

アイテムの後に追加:

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

ドキュメントhttp://dev.sencha.com/deploy/touch/docs/?class=Ext.TabBarを参照してください

于 2010-10-15T11:45:37.683 に答える
3

特定のケースで、1つのタブの場合にのみイベントをトリガーする場合は、activateそのタブのイベントをリッスンできます。

items: [{
        xtype: 'button',
        title: 'Test',
        html: 'Test',
        iconCls: 'info',
        cls: 'card1',
        listeners: {
            activate : function() {alert("bam!")}
        }
    }]
于 2011-03-14T14:37:33.940 に答える