PDA

View Full Version : Tabpaenl close



christophe67
29 Apr 2011, 3:13 AM
Hello,
I need to close a tab panel, but when I use the closable:true I can not re-open the tab.
Can annybody give an example of how to use this method properly.
Tahnks

friend
29 Apr 2011, 6:54 AM
A 'close' is an implicit 'destroy' of the panel being closed. Set autoDestroy: false for the component which is acting as a tab, then add a listener for the beforeclose event, hide the component and return false to prevent closure/destruction.

Note that you still have to keep track of the childTab object reference and later call tp.add(childTab) when you want to open the tab again.



var childTab = {
xtype: 'panel',
autoDestroy: false,
listeners: {
beforeclose: function(panel) {
panel.hide();
return false;
}
}
};

var tp = new Ext.TabPanel({
activeTab: 0,
items: [childTab]
});