在单击时尝试在选项卡面板中调用函数方法时,方法在侦听器中调用。这是我的代码,
var homepnl=Ext.create('Ext.TabPanel', {
id:'homepnl',
width:'100%',
height:'100%',
tabBarPosition: 'bottom',
defaults: {
styleHtmlContent: true
},
items: [
{
title: 'My Items',
iconCls: 'star',
id:'divtab1',
items: [myitemspnl]
},
{
title: 'Add Items',
iconCls: 'compose',
id:'divtab2',
items: [additemspnl]
},
{
title: 'Friend List',
iconCls: 'team',
//id:'friendsid',
id:'divtab3',
items:[friendslistpnl],
},
{
title: 'Search',
iconCls: 'search',
items: [searchpnl]
},
{
title: 'Settings',
iconCls: 'settings',
items: [settingspnl]
}
],
listeners: {
tabchange: function (homepnl, tab) {
alert(homepnl.id);// No alert is coming here
}
}
});
我的代码在这里有什么问题?请帮我解决
答案 0 :(得分:0)
我正在查看Sencha touch文档,没有事件tabchange
。请参阅documentation。
您可以使用activeitemchange活动。
在侦听器中使用以下代码:
listeners: {
activeitemchange: function (homepnl, value, oldValue) {
alert(homepnl.id);
}
}