如何在选项卡面板中动态隐藏和显示选项卡



我有选项卡面板和里面的两个项目。我需要动态隐藏或显示选项卡,如果隐藏,则只选择其中一个项目。

代码示例

{
     xtype    : 'tabpanel',
     items: [
           {
                xtype: 'container',
                title : 'Group Info'
           },
           {
                xtype: 'container',
                title : 'Product Info'
           },
         ]
    }

所以在某些情况下,我不得不隐藏标签,只显示产品信息容器。。。

所以答案是

var tabPanel = Ext.ComponentQuery.query('#myTabPanel');
tabPanel = tabPanel[0];
tabPanel.getTabBar().hide();

只需获得对选项卡的引用并使用方法hidehttp://docs.sencha.com/touch/2.3.1/#/api/Ext.tab.面板方法面

//function in a controller
hideTab : function(){
    var tab = Ext.ComponentQuery.query('tab[title='Group Info]')[0];
    tab.hide()
}

最新更新