• easywaru
  • NEWBIE
  • 0 Points
  • Member since 2022

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies

Hi All,

 

I have a pageblocksection inside <apex:repeat> tag. So it will be around 10-15 pageblocksections in the page with proper data.

 

My requirement is as follows:

I need to have a link at the top of the page namely Collapse All, clicking on which all the pageglocksections should collapse. Same requirement for expanding all sections.

 

I am able to achieve this for a single pageblocksection with the following code.

<apex:page tabstyle="Account" standardController="Account" extensions="ttttttttttt">

<script>
function PageBlockSectionCollapse(el){

if(typeof twistSection === 'function'){ 
var theTwist = document.getElementById(el);
if(theTwist){
twistSection(theTwist.childNodes[0].childNodes[0]);
}
}
}
</script>
<apex:form >
<apex:pageBlock >

<apex:pageblockSection columns="1" showHeader="true" title="Add CI Relationships" id="CIRel">
<script>PageBlockSectionCollapse('{!$Component.CIRel}');</script>
123
</apex:pageblockSection>

<apex:commandLink value="123" oncomplete="javascript&colon;PageBlockSectionCollapse('{!$Component.CIRel}');"/>
</apex:pageBlock>

</apex:form>
</apex:page>

 

But if I give the pageblocksection inside repeat tag, I am not able to access the id of pageblocksection using document.getElementbyId. I thought it would come as an array in the javascript function and all sections will be collapsed.

 

Any suggestions will be helpful.

 

Thanks

Arvind