我设置的监听器似乎没有触发。这是我的代码:
new Ext.TabPanel({
id:'content-tab-panel',
renderTo: 'trx_tabs_ext',
activeTab: 0,
minTabWidth: 150,
tabWidth:180,
enableTabScroll: true,
autoScroll: true,
resizeTabs:true,
defaults: {
autoScroll:true
},
items: [{
title: 'No Active Chat',
id: 'no_chat',
closable: true,
autoScroll: false,
margins: '0 0 0 0',
html: "<div id=\"chat_window_viewer\" style=\"width:900px;height:440px;text-align:left; \"> </div>"
}],
width: '100%',
height: '400px',
listeners: {
tabchange: function(tabPanel, newTab, oldTab, index)
{
console.log('change tab');
},
beforeadd : function (tabpane, component, index) {
console.log('Adding new tab');
},
beforeclose: function(element) {
console.log('closing');
}
}
});
beforeadd a tabchange 会触发并通过在控制台写入日志来执行此操作。但是,beforeclose 则不然。
我也尝试将它放在 Tabpanel 的项目中,也不起作用。
在 TabPanel 中添加关闭事件的正确方法是什么?
最佳答案
要获取项目关闭事件,请向该项目添加监听器。
关于javascript - 带有可关闭选项卡的 ExtJs Tabpanel 关闭事件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23239512/