【问题标题】:remove tab from pab panel in extjs从 extjs 中的 pab 面板中删除选项卡
【发布时间】:2013-10-15 09:43:02
【问题描述】:

当我在 tabpanel 中使用 remove 方法时:

this.tabPanel.remove(tab); 

它在最后设置了 setActive 选项卡。我想设置在以前的。现在我可以这样做了吗?

【问题讨论】:

    标签: extjs extjs4.2


    【解决方案1】:

    您可以处理beforeremove事件来获取被移除标签的索引并设置上一个。

    var tabs = Ext.create('Ext.tab.Panel', {
        items: [{
            title: 'Tab 1',
            html: 'A simple tab',
            closable: true
        }, {
            title: 'Tab 2',
            closable: true,
            html: 'Another one'
        }, {
            title: 'Tab 3',
            closable: true,
            html: 'Another one'
        }],
        renderTo: Ext.getBody()
    });
    
    tabs.on('beforeremove', function(tabs, tab) {
            var idx = tabs.items.indexOf(tab) - 1;
            setTimeout(function() {
                tabs.setActiveTab(idx);
            }, 350);
    
    });
    

    您可以查看working example

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-01-25
      • 1970-01-01
      • 2018-04-28
      相关资源
      最近更新 更多