EasyUI Forum
June 28, 2024, 11:45:24 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Enable Tab  (Read 11133 times)
varonica
Full Member
***
Posts: 106


View Profile
« on: July 10, 2012, 07:05:29 PM »

Sir, I really need your help!!! Can you tell me how to enable tab again after it disabled Huh I can't doing anything bcoz of it!!!
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');
});
}
});

// Style
<style>
.tabs li.tabs-disabled a,.tabs li.tabs-disabled a:hover{
background:#ccc;
}
</style>

//Call Method
$('#tt').tabs('disableTab', 1);  // the tab panel index start with 0

 Plz  Plz Plz Help me Sad Cry
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 on: July 11, 2012, 12:55:13 AM »

To enable a tab panel, rebind the click event for tab panel and close button, please refer to the following code:

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');
});
},
enableTab: function(jq, which){
return jq.each(function(){
var target = this;
var panel = $(target).tabs('getTab', which);
var tab = panel.panel('options').tab;
tab.removeClass('tabs-disabled').unbind('.tabs').bind('click.tabs', {p:panel}, function(e){
var index = $(target).tabs('getTabIndex', e.data.p);
$(target).tabs('select', index);
}).bind('contextmenu.tabs', {p:panel}, function(e){
var opts = $(target).tabs('options');
var index = $(target).tabs('getTabIndex', e.data.p);
opts.onContextMenu.call(target, e, e.data.p.panel('options').title, index);
});
tab.find('a.tabs-close').unbind('.tabs').bind('click.tabs', {p:panel}, function(e){
var index = $(target).tabs('getTabIndex', e.data.p);
$(target).tabs('close', index);
return false;
});
});
}
});
Logged
varonica
Full Member
***
Posts: 106


View Profile
« Reply #2 on: July 18, 2012, 09:12:59 PM »

Thank for you help sir !! ^^ Grin Grin Grin Grin Grin Wink Wink Wink Wink
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!