function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
vineet kumarvineet kumar 

How to make a pageBlockSection Collapsible, when click only.?

Best Answer chosen by vineet kumar
Ajay K DubediAjay K Dubedi
Hi Vineet,

Below code can fulfill your requirements. Hope this will work for you.

<apex:page showHeader="true" sidebar="true">
<apex:pageBlock id="block1">
    <apex:pageBlockSection id="section1" columns="2" collapsible="true" title="Title">
        Example Area
    </apex:pageBlockSection>
    <script>
        twistSection(document.getElementById('{!$Component.block1.section1}').getElementsByTagName('img')[0])
    </script>

</apex:pageBlock>
</apex:page>

Please mark this as best answer if this solves your problem.

Thank you
Ajay Dubedi

All Answers

SandhyaSandhya (Salesforce Developers) 
Hi,

Refer below links which has the solution for the same.

https://salesforce.stackexchange.com/questions/87925/how-to-make-a-pageblocksection-collapsible-when-click?rq=1
 
http://salesforce-stuff.blogspot.com/2011/11/collapse-pageblocksection.html
 
Please mark it as solved if my reply was helpful. It will make it available for other as the proper solution.
                                             
Best Regards
Sandhya
 
Ajay K DubediAjay K Dubedi
Hi Vineet,

Below code can fulfill your requirements. Hope this will work for you.

<apex:page showHeader="true" sidebar="true">
<apex:pageBlock id="block1">
    <apex:pageBlockSection id="section1" columns="2" collapsible="true" title="Title">
        Example Area
    </apex:pageBlockSection>
    <script>
        twistSection(document.getElementById('{!$Component.block1.section1}').getElementsByTagName('img')[0])
    </script>

</apex:pageBlock>
</apex:page>

Please mark this as best answer if this solves your problem.

Thank you
Ajay Dubedi
This was selected as the best answer