• NickKahn
  • NEWBIE
  • 0 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 0
    Replies
This script works well if you are NOT using the `<apex:repeat`
 
<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'};
     
        } 
    }