EasyUI Forum
September 14, 2025, 02:46:25 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Disable Tab  (Read 13284 times)
WeberJ65
Newbie
*
Posts: 6


View Profile Email
« 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
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 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
Logged
varonica
Full Member
***
Posts: 106


View Profile
« Reply #2 on: June 29, 2012, 08:11:26 PM »

how can we enable it again Huh 
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!