EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: WeberJ65 on June 18, 2012, 02:07:35 AM



Title: Disable Tab
Post by: WeberJ65 on June 18, 2012, 02:07:35 AM
Hallo,

how to disable or enable a Tab dynamically? I found no properties or method to do this.

Thanks for your answer.
Joe


Title: Re: Disable Tab
Post by: stworthy on June 18, 2012, 08:23:53 PM
There are no methods to disable a tab panel, but extending a new method to do this is available. The code below demonstrate a simple way to implement the 'disableTab' method.
Code:
$.extend($.fn.tabs.methods,{
disableTab: function(jq, which){
return jq.each(function(){
var tab = $(this).tabs('getTab', which).panel('options').tab;
tab.addClass('tabs-disabled').unbind('.tabs');
tab.find('a.tabs-close').unbind('.tabs');
});
}
});
Add a new CSS class named 'tabs-disabled' for the disabled tab panel.
Code:
<style>
.tabs li.tabs-disabled a,.tabs li.tabs-disabled a:hover{
background:#ccc;
}
</style>
Now call 'disableTab' method to disable the second tab panel:
Code:
$('#tt').tabs('disableTab', 1);  // the tab panel index start with 0


Title: Re: Disable Tab
Post by: varonica on June 29, 2012, 08:11:26 PM
how can we enable it again ???