In this article i am going to explaining how to expand only selected tab from left side navigation links and other tab will collapsed
you need to call this "SetTabonClick" javascript function on your form onload event to auto expand and collapse tabs from left side navigation links
function SetTabonClick() {
var tabs = Xrm.Page.ui.tabs.get();
for (var i in tabs) {
var tab = tabs[i];
var tabName = tab.getName();
var tabindex = 'tab' + i;
var tabindexTab = 'tab' + i + 'Tab';
toggleTabDisplayState(tabName, tabindex, tabindexTab);
}
}
function toggleTabDisplayState(tabName, tabindex,tabindexTab) {
var link = document.getElementById(tabindexTab); //tab1Tab
link.onclick = function () {
loadArea('areaForm');
crmForm.GetTab($get(tabindex, crmForm), true); //tab1
var tabs = Xrm.Page.ui.tabs.get();
for (var i in tabs) {
var tab = tabs[i];
if (tab.getName() == tabName) {
tab.setDisplayState("expanded");
}
else {
tab.setDisplayState("collapsed");
}
}
}
}