gpt4 book ai didi

extjs - 单击 EXTJS 中选项卡面板的监听器

转载 作者:行者123 更新时间:2023-12-04 16:48:39 25 4
gpt4 key购买 nike

我在 extjs 中使用标签面板。我想在单击选项卡时显示警报。但我不确定如何。

这就是我现在要做的:

{
xtype: 'tabpanel',
activeTab: 0,
region: 'center',
items: [
{
xtype: 'panel',
title: 'All',
items: [grid]

},
{
xtype: 'panel',
title: 'Closed'
},
{
xtype: 'panel',
title: 'Open'
}
],
listeners: {
click: function () {
alert('test');
}
}
}

单击该选项卡时如何显示全部、关闭或打开?

最佳答案

TabPanel中没有标签点击事件,但是您可以绑定(bind)到每个选项卡上的单击事件:

Ext.createWidget('tabpanel', {
items: [...],
listeners: {
render: function() {
this.items.each(function(i){
i.tab.on('click', function(){
alert(i.title);
});
});
}
}
});

注意:这是基于 ExtJS 4 的代码。

关于extjs - 单击 EXTJS 中选项卡面板的监听器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8985567/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com