私は最初の小さな Sencha Touch 2 アプリを構築しようとしています。期待どおりに機能するものをいくつか作成しましたが、イベント処理のものを作成したいと思います。
次のストアを作成しました。
Ext.define('Mobile.store.Blogs', {
extend: 'Ext.data.Store',
config: {
},
listeners: {
'load' : function(store,records,options) {
store.loaded = true;
console.log("fired blogCountAvailable");
store.fireEvent("blogCountAvailable");
},
'blogCountAvailable': function(store, records, options) {
console.log("blogCountAvailable has been fired");
}
}
});
これは期待どおりに機能しますが、次のステップに進みます。
これが私のタブパネルバーのコードです:
Ext.create("Ext.tab.Panel", {
xtype:'mainTabPanelBottom',
tabBarPosition: 'bottom',
fullscreen: true,
items: [
{
title: 'Blog',
iconCls: 'home',
xtype:'mainpanel'
},
{
title: 'Users',
iconCls: 'user',
xtype:'userpanel'
}
],
listeners: {
blogCountAvailable: function(tabpanel, newTab) {
var tab = newTab.tab,
badge = 10;
tab.setBadge(badge);
console.log("blogCountAvailable has been fired");
}
}
});
私の質問は、カスタム イベントblogCountAvailable
をタブ パネルに「起動」する方法を教えてください。