You need to sign in to do that
Don't have an account?
![Jon Keener Jon Keener](https://dfc-org-production.my.site.com/img/userprofile/default_profile_45_v2.png)
Setting how a Collapsible PageBlockSection is rendered
Is there any way to force a Collapsible PageBlockSection to start in a collapsed mode, when the page is rendered? I know with standard page layouts, this isn't possible, but Salesforce remembers what a user chooses and uses that in the future to determine the collapsible state when rendering a page. So far, I have not seen this same behavior with Visualforce pages. It would be nice to have a parameter on the PageBlockSection that controls the initial behavior of a collapsible PageBlockSection when it it first rendered.
Jon Keener
Message Edited by Jon Keener on 02-14-2008 01:06 PM
Parker,
I am trying to achieve same functionality.
In the above sample code, we are passing the reference of the VF component to twistSection.
But, where exactly are we setting the default collapsed setting for pageblocksection?
In Salesforce Jscript library, they have twistSection method that does the implementation
for collapse and expand function of a section.
Is it possible to change the settings in their library?
Please post a sample code.
Thanks
KK
So I know it's about a year late, but I needed to do this for my own project, and figured I'd share some sample code.
1. uploaded a static resource, pageBlockSupplement.js, containing:
function PageBlockSectionCollapse(el){ if(typeof twistSection === 'function'){ var theTwist = document.getElementById(el); if(theTwist){ // twistSection expects you to click on the IMG link, this targets that img twistSection(theTwist.childNodes[0].childNodes[0]); } }}
2. made a new VF page containing:
<apex:page tabstyle="CustomObject__c" standardController="CustomObject__c"><apex:includescript value="{!$Resource.pageBlockSupplement.js}" /> <apex:pageBlock > <apex:pageblockSection columns="1" showHeader="true" title="Add CI Relationships" id="CIRel"> <script>PageBlockSectionCollapse('{!$Component.CIRel}');</script> <c:myComponent target="{!$CurrentPage.parameters.id}" showFilters="true"/> </apex:pageblockSection> </apex:pageBlock></apex:page>
You can call the includeScript anywhere, but the call to PageBlockSectionCollapse needs to be within the pageBlock.
It would be nice to have this feature natively.
If you want too, please help to promote this ideia:
http://ideas.salesforce.com/article/show/10098227/Add_Collapsedtrue_option_to_ltapexpageblocksection