You need to sign in to do that
Don't have an account?
NickKahn
Collapse PageBlockSection by default on page load
This script works well if you are NOT using the `<apex:repeat`
Using with `<apex:repeat` does not work, I able to duplicate and here is the code:
How to collapse the `<apex:pageBlockSection>` on page load? I'm getting a `null` below is the code:
VFP:
Apex:
<script> twistSection(document.getElementById('{!$Component.pb.pbs}').getElementsByTagName('img')[0]) </script>
Using with `<apex:repeat` does not work, I able to duplicate and here is the code:
How to collapse the `<apex:pageBlockSection>` on page load? I'm getting a `null` below is the code:
VFP:
<apex:page sidebar="false" controller="repeatCon"> <apex:form > <apex:repeat value="{!strings}" var="string" id="theRepeat"> <apex:pageBlock title="hiding pb" mode="edit " id="pb"> <apex:pageBlockSection title="my title" columns="1" id="pbs" > some text here... </apex:pageBlockSection> </apex:pageBlock> </apex:repeat> <script> twistSection(document.getElementById('{!$Component.pb.pbs}').getElementsByTagName('img')[0]) </script> </apex:form> </apex:page>
Apex:
public class repeatCon { public PageReference createNewJobDetailBtn() { return null; } public String[] getStrings() { return new String[]{'ONE','TWO','THREE'}; } }
<apex:repeat>
<apex:pageBlockSection title="Section" id="Sec1">
<script>twistSection(document.getElementById('img_{!$Component.Sec1}'));</script>