【发布时间】:2014-05-28 12:44:30
【问题描述】:
我可以在加载商店后获取商品数量,我想知道如何以及在何处更新当前视图中标签栏中的按钮的徽章文本。
这里有我的视图面板,我认为我可以在初始化函数中设置标记文本:
Ext.define('connect.view.InProgressPanel', {
extend: 'Ext.NavigationView',
xtype: 'inprogressPanel',
requires: [
'connect.view.inprogressleads.InProgressList'
],
config: {
itemId: 'inprogressPanel',
title: 'Leads In Process',
iconCls: 'team',
items:[{
title: 'Leads In Process',
xtype: 'inprogressList'
}]
},
initialize: function( eOpts ) {
var store = Ext.getStore('InProgressLeads');
store.on('load', function () {
var listCount = store.getCount();
console.log(listCount);
// set the badge here
});
}
});
在这里,我在主视图中定义面板的按钮:
{
id: 'lipPanel',
title: 'Leads In Process',
iconCls: 'team',
items: [{
xtype: 'inprogressPanel'
}]
},
我读过我可以给按钮一个 ID,然后我可以使用 ID 来获取对按钮的引用,但是当我以这种方式定义按钮时,我还没有找到任何方法来指定按钮的 ID在主面板中。还是有其他方法来获取按钮并设置徽章文本?
更新:这里是设置徽章的方法:
<code>
store.on('load', function () {
var listCount = store.getCount();
var apptabbar = Ext.getCmp('ext-tabbar-1');
var tab = apptabbar.down('.tab[title=Leads In Process]');
tab.setBadgeText(listCount);
});
</code>
【问题讨论】:
标签: sencha-touch