You need to sign in to do that
Don't have an account?
vikramkk
Pageblock section collapsible
Hi
I want a pageblock section to be collapsed by default at the time of page loading. I tried using solutions posted on our discussion board but none of them are working correctly. Please post the correct approach.
thanks
All Answers
try this
That's just a painful scripting experience. Here's my solution:
The internal library takes care of all the little details for you.
Hi
This worked fantastic.But in the pageblock section I have a commandlink by clicking which a pageblocktable is displayed. But I click the link the pageblock section is getting collapsed again. Can I prevent this collapsing. It would be great if I can do that.
Thanks
You'd have to use a cookie or something to remember the state of the page. If you're using the Visualforce AJAX library, you can store the state in local variable during the onsubmit handler, then re-expand the elements that should be using the oncomplete handler.
Do you need to reference any special library to use your example sfdcfox?
I get "Syntax Error" when I try to save your example.
/Mats
It's window.twistSection, located in /jslibrary/<timestamp>/main.js. If you're doing this in Visualforce, make sure you do not disable the standard headers or the function won't be available. The example I provided is a Visualforce page that I wrote to demonstrate the function, and copied from a working example in my developer account verbatim; I wrote the code specifically for this post. As of today, it still works.
to add on a request here.
I want to have collapsable sections for the data in my custom comments display, which displayed with OutoutField gets very large.
while I don't get any errors, I also don't get anything displayed.
if I use column of course everything displays, but then I can't use the collapsable twisty..
ideas?
we might have 100's of comments, and don't want to (always) force display the text
Sam
Thanks It worked for me................
How would you get this to work for pageblock sections nested in a repeat?. Here is a boiled down version of my code.
Thanks in advance for any help!
Jeremy Stender
How to make this work for visual force page with repeat class, here is my VF , i just want to make this collapsable on default
<apex:page controller="AutomobileDashboard" sidebar="false">
<h1>Accounts with Related Opportunities</h1>
<apex:form >
<apex:pageBlock id="table" >
<apex:repeat value="{!accttree}" var="a" id="table">
<apex:pageblockSection title="{!a.Name}" columns="1" collapsible="true" id="CollapseDefault">
<table width="100%" cellpadding ="0" cellspacing = "0">
<tr>
<th>Name</th>
<th>Status</th>
<th>Close Date</th>
<th>Description</th>
<th>Highlights</th>
<th>Mitigation</th>
<th>Region</th>
<th>Amount</th>
</tr>
<tr>
<td width='5%'></td>
<td width='5%'></td>
<td width='5%'></td>
<td width='30%'></td>
<td width='20%'></td>
<td width='20%'></td>
<td width='5%'></td>
<td width='5%'></td>
</tr>
<apex:repeat value="{!a.opps}" var="c">
<tr>
<td><table> <apex:outputlink value="/{!c.id}" target="_blank">
<apex:outputtext value="{!c.Name}"/>
</apex:outputlink></table></td>
<td><table><apex:outputText label="" value="{!c.Status__c}" escape="false"/></table></td>
<td><table><apex:outputText label="" value="{0,date,MM/dd/yyyy}"><apex:param value="{!c.CloseDate}" /></apex:outputText></table></td>
<td><table><apex:outputText label="" value="{!c.Description}"/></table></td>
<td><table><apex:outputText label="" value="{!c.Highlights__c}" style="white-space:pre-wrap;"/></table></td>
<td><table><apex:outputText label="" value="{!c.Mitigation__c}" style="white-space:pre-wrap;"/></table></td>
<td><table><apex:outputText label="" value="{!c.Region__c}"/></table></td>
<td><table><apex:outputText label="" value="{0,number, ###,###,###,###}">
<apex:param value="{!c.Amount}"/>
</apex:outputText></table></td>
</tr>
</apex:repeat>
</table>
</apex:pageblockSection>
</apex:repeat>
</apex:pageBlock>
</apex:form>
</apex:page>
Where would I go to enter this code in Sales Force?
Tahnks