2
私は最初の小さなSencha Touch 2アプリを作ろうとしています。私は期待どおりに動作しているいくつかのものを作成しましたが、今はいくつかのイベント処理用のものを作成したいと思うかもしれません。SenchaTouch2 - 店舗のロードイベントを聞いて、タブパネルの項目「badgeText」を設定
私は、次のストアを作成しました:
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」にそれを達成できるかです。
fireEvent(。 "blogCountAvailable"); ' –
ありがとう、これは動作します! – Marc
あなたは歓迎します、Stackoverflowのルールに従って質問を解決する答えを受け入れてください –