如何隐藏ExtJS 4中的选项卡

时间:2011-11-01 20:13:03

标签: extjs extjs4

如何隐藏ExtJS 4中的标签? Ext.getCmp(“mytab”)。hide()不起作用 任何人都可以帮助我吗?

3 个答案:

答案 0 :(得分:20)

请阅读此处的文档:http://docs.sencha.com/ext-js/4-0/#!/api/Ext.tab.Panel

他们提供了一个如何隐藏标签的具体示例

从链接中提取:

    var tabs = Ext.create('Ext.tab.Panel', {
    width: 400,
    height: 400,
    renderTo: document.body,
    items: [{
            title: 'Home',
            html: 'Home',
            itemId: 'home'
        }, {
            title: 'Users',
            html: 'Users',
            itemId: 'users',
            hidden: true
        }, {
            title: 'Tickets',
            html: 'Tickets',
            itemId: 'tickets'
        }]
 });
 setTimeout(function () {
    tabs.child('#home')
        .tab.hide();
    var users = tabs.child('#users');
    users.tab.show();
    tabs.setActiveTab(users);
 }, 1000);

答案 1 :(得分:1)

如果您的选项卡面板具有ID,并且组件具有ID或项ID,则可以执行以下操作:Ext.getCmp('TAB_PANEL_ID')。getComponent('ITEM_ID')。tab.hide()

例如,

var tabPanel = Ext.create("Ext.tab.Panel", {
               id: 'TAB_PANEL_ID',
               renderTo: Ext.getBody(),
               items:[{
                   title: 'Tab 1',
                   itemId: 'TAB_1',
                   html: 'This is the first tab'
               },{
                   title: 'Tab 2',
                   itemId: 'TAB_2',
                   html: 'This is the second tab'                                     
              },{
                   title: 'Tab 3',
                   itemId: 'TAB_3',
                   html: 'This is the third tab'                          
             }]                  
});

// You may want to add following in function body or inside event handler.
// Hide the second tab:     
Ext.getCmp('TAB_PANEL_ID').getComponent('TAB_2').tab.hide();

// Show the second tab:  
Ext.getCmp('TAB_PANEL_ID').getComponent('TAB_2').tab.show();

答案 2 :(得分:-3)

这是禁用/启用标签内容的示例。

在这个例子中,我们有一个名为“Desabilitar”的按钮,单击他,该选项卡的第一个子项将被禁用。 标签内容将在9秒内启用。

https://fiddle.sencha.com/fiddle/21h/preview

相关问题