PDA

View Full Version : [OPEN] EXT 1.1Beta TabPanel.removeTab('tabId') does ! auto hide tabpanel when 1 panel active



jay@moduscreate.com
20 Jun 2007, 11:54 AM
http://extjs.com/forum/showthread.php?p=40374#post40374

the clickable X is a 'closeClick function which is using the exact same public method removeTab but when called explicitly it does not behave the same way



closeClick : function(e){
var o = {};
e.stopEvent();
this.fireEvent("beforeclose", this, o);
if(o.cancel !== true){
this.tabPanel.removeTab(this.id);
}
},




/**
* Remove a TabPanelItem.
* @param {String/Number} id The id or index of the TabPanelItem to remove.
*/
removeTab : function(id){
var items = this.items;
var tab = items[id];
if(!tab) return;
var index = items.indexOf(tab);
if(this.active == tab && items.length > 1){
var newTab = this.getNextAvailable(index);
if(newTab)newTab.activate();
}
this.stripEl.dom.removeChild(tab.pnode.dom);
if(tab.bodyEl.dom.parentNode == this.bodyEl.dom){ // if it was moved already prevent error
this.bodyEl.dom.removeChild(tab.bodyEl.dom);
}
items.splice(index, 1);
delete this.items[tab.id];
tab.fireEvent("close", tab);
tab.purgeListeners();
this.autoSizeTabs();
},

jack.slocum
20 Jun 2007, 5:44 PM
Can you explain what the problem is? I was unable to decipher from the other thread.

jack.slocum
20 Jun 2007, 5:46 PM
Nevermind, the title has a description.

Calling remove on the TabPanel is not the same as with the BorderLayout. The auto hide is provided by the BorderLayout so if you want that behavior you would need to call remove on the BL not the TabPanel.

jay@moduscreate.com
21 Jun 2007, 5:37 AM
Nevermind, the title has a description.

Calling remove on the TabPanel is not the same as with the BorderLayout. The auto hide is provided by the BorderLayout so if you want that behavior you would need to call remove on the BL not the TabPanel.

:-? didn't consider that . duh me. So does the border layout add a before close event?

jay@moduscreate.com
21 Jun 2007, 6:54 AM
You are the man!!

title is open by default, needs to be closed whenever a new panel is added.

Awesome!


clearTitle: function() {
var tabPanel = layout.getRegion('center').getTabs()

if (tabPanel.getTab('title') ) {
layout.beginUpdate();
layout.getRegion('center').remove('title');
layout.endUpdate();
}

}