PDA

View Full Version : Remove tab(button) from TabPanel and TabBar



alessiolu11484
20 Feb 2011, 2:40 PM
Can i remove the button of a panel in the TabBar of a TabPanel? if is possible can you explain me how?
Thanks very much :)

adjohnson916
13 Jul 2011, 6:33 PM
Bump! I want to do this as well! Help?

AndreaCammarata
14 Jul 2011, 1:55 AM
Hey.
I wrote you a simple example that make you able to hide a TabBar button when you need it with the first Toolbar button. Obviously when you hide the button, you have no more a way to display the linked tab using the UI, so you need to display it runtime (second toolbar button).




Ext.setup({

onReady: function() {

var panel = new Ext.TabPanel({
fullscreen: true,
dockedItems: [{
xtype:'toolbar',
dock: 'top',
title: 'Example',
items: [{
text: 'Hide TapBar Button',
handler: function(){

//Hide the TabPanel Button
panel.getTabBar().getComponent(1).hide('pop');

}
},{
text: 'Show No Button Tab',
handler: function(){

//Show the Tab without button
panel.setActiveItem('tbInfo');

}
}]
}],
items: [{
title: 'Home',
iconCls: 'home',
html:'<h1>1. Panel</h1>',
itemId: 'tbHome'
},{
title: 'Info',
iconCls: 'info',
html:'<h1>1. Info Panel</h1>',
itemId: 'tbInfo'
}],
tabBar: {
dock:'bottom',
cardSwitchAnimation:'slide',
sortable: false,
scroll: {
direction: 'horizontal',
useIndicators: true
},
layout: {
pack:'center'
}
}
});
}

});



Hope this helps both of you.