I am using DHTMLX tabs, in my case, initially my tab is in InActive
state. When user clicked initially the tab comes to Active
and loading the content using setContentHref()
.
Again if I click on the same tab for second time I don't want to display the content and the tab comes to initial state.
For this I have implemented like
tabbar.attachEvent("onTabClick", function (id, prevId) {
alert(id); alert(prevId);
if (id == prevId) {
tabbar.setTabInActive(id);
return true;
}
});
but the tab does not come into the InActive
state. Can you tell me how to do this?
onTabClick occurs before a tab is selected and setTabInActive doesn't block selection. Therefore, you need to set onSelect handler, for example like so:
var disabledTab;
tabbar.attachEvent("onTabClick", function (id, prevId) {
if (id == prevId) {
tabbar.setTabInActive(id);
disabledTab = id;
}
});
tabbar.attachEvent("onSelect", function (id, prevId) {
if (id == disabledTab) {
return false;
}
disabledTab = null;
return true
});