By default all tabs have close buttons. But how can I tell there is only one tab left and remove the close button from it?
If a user closes all tabs; if the last remaining tab has a close button then how do I redraw the tab without the close button? Contents should remain the same.
You may use the following approach to hide close button:
yourTabbar._tabs[“tabId”].childNodes[4].style.display = “none”;
tabbar.attachEvent("onTabClose",function(id){
if(this.getNumberOfTabs()==2){
for(var i in this._tabs){
this._tabs[i].childNodes[4].style.display = "none";
}
}
return true;
})
Sorry that don’t work. I receive the following error.
this._tabs[i].childNodes[4] is undefined
disregard my last message I got it to work with the following. I hope this helps others.
tabbar.attachEvent(“onTabClose”, function(id,prev_id){
if(this.getNumberOfTabs()==2){
Object.keys(this._tabs).forEach(function(key) {
tabbar._tabs[key].childNodes[4].style.display = “none”;
});
}
}