4

This my TabPanel code:

inside the code there is two tabs (tab1 and tab2) in the TabPanel (tabs_panel)

MyTabPanelUi = Ext.extend(Ext.TabPanel, {
    activeTab: 0,
    height: 210,
    resizeTabs: true,
    tabWidth: 266,
    id: 'tabs_panel',
    initComponent: function () {
        this.items = [{
            xtype: 'panel',
            title: 'Project',
            padding: 20,
            height: 150,
            id: 'tab1'
        }, {
            xtype: 'panel',
            title: 'Service',
            height: 150,
            padding: 20,
            id: 'tab2'
        }]
    }
});

I'm trying to hide tab2 using bellow code but this bellow code

var tabPanel = Ext.getCmp('tabs_panel');
var tabToHide = Ext.getCmp('tab2');
tabPanel.hideTabStripItem(tabToHide);

but somehow this above code does not work for me. How can I fix the problem?

4

2 回答 2

5

你有两种可能:

var tabPanel = Ext.getCmp('tabs_panel');
tabPanel.hideTabStripItem("tab2"); // with tab id

或者

var tabPanel = Ext.getCmp('tabs_panel');
tabPanel.hideTabStripItem(1); // with tab index
于 2013-05-11T09:44:11.667 回答
0

试试这个

Ext.getCmp("tab").child('#id').tab.hide()

于 2014-03-20T06:45:07.103 回答