Friday 4 September 2015

How to make pageblock section to be collapsed by default

Hi All,

We can achieve it through java script.

<apex:page standardController="Account">
<apex:form>
<apex:pageBlock id="block1">
    <apex:pageBlockSection id="section1" columns="2" collapsible="true" title="Collapsebale Section">
        <apex:inputField value="{!Account.Name}"/>
         <apex:inputField value="{!Account.Phone}"/>
    </apex:pageBlockSection>
    
<script> twistSection(document.getElementById('{!$Component.block1.section1}').getElementsByTagName('img')[0]) </script>
</apex:pageBlock>
</apex:form>
</apex:page>

Normal Section


Collapsed Section  

No comments: