Met onderstaand script creëer je een sectie die je open- of dicht kunt klappen:
function OnCrmPageLoad()
{
/* false - collapsed, true - expanded */
//First Tab, Second Section, Expanded
ConvertSection(0,1,false);
//First Tab, Third Section, Collapsed
ConvertSection(0,2,false);
}
function ConvertSection( tabIndex , sectionIndex , state ) {
var sec = document.getElementById( "tab" + tabIndex );
var td = sec.childNodes[0].rows[ sectionIndex ].cells[0].childNodes[0].rows[0].cells[0];
var secHTML = td.innerHTML;
state = (typeof(state) == "undefined")? false:!state;
var src = (state == false)? "/_imgs/tree/dashPlus.gif":"/_imgs/tree/dashMinus.gif";
td.innerHTML = "<NOBR style='VERTICAL-ALIGN: middle;cursor:hand' onclick='excoSection(this)'><IMG src='" + src + "' align='middle' /> " + td.innerHTML + "</NOBR>";
td.childNodes[0].childNodes[0].state = state;
excoSection(td.childNodes[0]);
}
/* Toggle SectionState */
function excoSection( sec ) {
sec = sec.childNodes[0];
sec.state = !sec.state;
sec.src = (sec.state)? "/_imgs/tree/dashMinus.gif":"/_imgs/tree/dashPlus.gif";
var display = (sec.state)? "inline" :"none";
var tblsec = sec.parentElement.parentElement.parentElement.parentElement;
for( var i =1 ; i < tblsec.rows.length ; i++ )
tblsec.rows[i].style.display = display;
}
//Expose the toggling function at the window level
this.excoSection = excoSection;
OnCrmPageLoad();
Geen opmerkingen:
Een reactie posten