最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How to dynamically hide and show tabs in tabpanel - Stack Overflow

programmeradmin1浏览0评论

I have tabpanel and 2 items inside. I need dynamically hide or show tabs and select only one of items if hide.

Code example

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

So in some cases I have to hide tabs and show only product info container...

I have tabpanel and 2 items inside. I need dynamically hide or show tabs and select only one of items if hide.

Code example

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

So in some cases I have to hide tabs and show only product info container...

Share Improve this question edited Sep 3, 2014 at 14:33 Oleg Patrushev asked Sep 3, 2014 at 14:21 Oleg PatrushevOleg Patrushev 2653 silver badges16 bronze badges 1
  • What version of Ext? Can you post your code?Did you search for similar questions? stackoverflow./questions/16494264/… – pherris Commented Sep 3, 2014 at 14:24
Add a ment  | 

2 Answers 2

Reset to default 4

so the answer is

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

Just get a reference to the tab and use method hide http://docs.sencha./touch/2.3.1/#!/api/Ext.tab.Panel-method-hide

//function in a controller

hideTab : function(){
    var tab = Ext.ComponentQuery.query('tab[title='Group Info]')[0];
    tab.hide()
}
发布评论

评论列表(0)

  1. 暂无评论