+ Start a Discussion
PbondalapatiPbondalapati 

How can I make visualforce sections Collapsed

I have a visual force page assigned to tab 

when user opened the vf page ,all sections need to collapsed. We need to give chance to user expand the sections?

Swathi JainSwathi Jain

Hi ,

This is swathi , 

I tried with this code ,  but it is not working 

<apex:page id="thePage" sidebar="false">
<apex:pageBlock >
<apex:pageBlockSection title="PG1" collapsible="true" id="CollapseDefault">
abccccccccccccc

</apex:pageBlockSection>
</apex:pageBlock>

<script language="javascript">
function addLoadEvent(func) {
var oldonload = window.onload;
if (typeof window.onload != 'function') {
window.onload = func;
} else {
window.onload = function() {
if (oldonload) {
oldonload();
}
func();
}
}
}

function dotest() {
twistSection(document.getElementById('j_id0:form9:j_id189:CollapseDefault').childNodes[0].childNodes[0]);
}

addLoadEvent(dotest);
</script>


</apex:page>