我们如何将点击监听器添加到 Tabbar 中的 activeitem,当我搜索时,我发现只有可用的事件是 activeitemchange,所以只有当我点击另一个项目然后点击 myitem 时才会执行该操作
问问题
2177 次
2 回答
1
添加侦听器时使用该delegate
属性将侦听器直接添加到选项卡本身:
var tabPanel = Ext.Viewport.add({
xtype: 'tabpanel',
items: [
{
title: 'one',
html: 'one'
},
{
title: 'two',
html: 'two'
}
]
});
tabPanel.on({
delegate: 'tab',
tap: function(tab) {
console.log(tab.getText());
}
});
于 2012-11-15T15:12:45.097 回答
0
更简单:
正常添加按钮,因为它将是一个选项卡......然后,在 tabpanel 配置元素中,添加:
listeners: {
activeitemchange: function(source, value, oldValue, eOpts) {
if(value.id == 'chiama') {
// do actions...
// for example open a link:
// document.location = 'www.google.it';
source.setActiveItem(oldValue); //avoid tab switching
return false; // avoid tab switching
}
}
}
于 2014-04-17T13:55:19.847 回答