user3136156
user3136156

Reputation: 43

Hide an item from Ext.TabPanel

When i click on a button i need to hide the edit toolbar from the tabpanel.

This is my tabpanel :

Ext.onReady(function(){
       mainimgwidth = $("#imgMain").prop("width");
       tabpanel = new Ext.TabPanel({
           activeTab: 0,
           deferredRender:false,
           items: [
               {

                  title : '${tr.File}',
                  items : [
                      fileTlb
                  ]
               },
               {
                  id: 'editToolbar',
                  title: '${tr.Edit}',
                  items : [
                      editTlb
                  ]
               },
               { 
                  title: '${tr.Review}'
               }
           ]
       });

I tried this but i didnt work:

function remove(){
       var edit = tabpanel.getComponent('editToolbar');
       edit.setVisible(false);
    }

I also tried to use : edit.hide();

This is the edit toolbar:

var editTlb = new Ext.Toolbar({ 
            id:'edit_tlb',
            items:[
                new Ext.Toolbar.Button({
                         id:'btn_rotate_right',
                         iconCls: 'icon_rotate_right'
                         }),
                new Ext.Toolbar.Button({
                         id:'btn_rotate_left',
                         iconCls: 'icon_rotate_left'
                         }),
                new Ext.Toolbar.Button({
                         id:'btn_rotate_vertical',
                         iconCls: 'icon_rotate_vertical'
                         })
        ]
});

Upvotes: 1

Views: 1072

Answers (2)

zyzof
zyzof

Reputation: 3685

Use edit.tab.show() and edit.tab.hide().

See the answer on How to hide tab in ExtJS 4 for an example from the Ext docs.

Upvotes: 0

weeksdev
weeksdev

Reputation: 4355

I believe you are looking for the method hide() This will hide the toolbar. To show the toolbar again use the method show().

Another option that you may see is disable/enable this makes the toolbar disabled but still visible.

Upvotes: 1

Related Questions