function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
kkvikram9kkvikram9 

Hide/show issue when components used inside repeat tag

The issue is I have a list of accounts which are in repeat tag.

So for example there are 2 records on page 1

->record1
          child of record1
->record2
          child of record2


on load of page child records are invisible. when I click on -> of record1,child of record1 should be displayed.

when I click on -> of record2,child of record2 should be displayed.

but the problem is when I click on record1, child of both record1 and record2 are displayed.

 

 

I have following visual force page:

 

<apex:page controller="CustomerMgmtEntitleview">
  <link rel="stylesheet" href="{!$Resource.ExecutiveSummariesResource}/css/executiveSummaries.css" type="text/css"/>
  <script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script>
 <apex:includeScript value="{!$Resource.ExecutiveSummariesResource}/js/jquery-1.6.2.min.js"></apex:includeScript>
    <apex:includeScript value="{!$Resource.ExecutiveSummariesResource}/js/jquery-ui-1.8.15.custom.min.js"></apex:includeScript>
    <apex:includeScript value="{!$Resource.ExecutiveSummariesResource}/js/executiveSummaries.js"></apex:includeScript> 
  <apex:form id="displayform">
      <apex:pageblock >
              <apex:panelGrid columns="4">
                    <apex:commandButton action="{!Beginning}" title="Beginning" value="<<" disabled="{!disablePrevious}" reRender="displayform"/>
                    <apex:commandButton action="{!Previous}" title="Previous" value="<" disabled="{!disablePrevious}" reRender="displayform"/>       
                    <apex:commandButton action="{!Next}" title="Next" value=">" disabled="{!disableNext}" reRender="displayform"/> 
              </apex:panelGrid>
        <apex:repeat value="{!accountList}" var="item">
                <apex:outputPanel rendered="{!OR(item.UserLicenseSet.size>0,item.OrganizationSet.size>0,item.FeatureSet.size>0,item.ServiceSet.size>0,item.PackageSet.size>0,true,false)}">
                    <div>
                    <img id="resultSectionImg" class="hideListButton"  style="cursor:pointer;" onclick="customTwistSection(this, 'tableSection');" src="/s.gif"/>
                    <font size="2">Entitlements for {!item.oAccount.Name}</font>
                    </div>
                    <div id="tableSection">
                     <apex:outputPanel layout="none" rendered="{!IF(item.OrganizationSet.size>0,true,false)}"> 
                             <b><div width="150" height="15" style="text-align: center;">&nbsp;<font size="2">Org Level Entitlements</font></div></b>
                                  <br/> 
                                   <apex:repeat id="repeatAccountOrg" value="{!item.OrganizationSet}" var="subitem">
                                       <apex:pageblocktable value="{!subitem}" var="con">
                                           <apex:column width="145px;">
                                               <apex:facet name="header">
                                                   <apex:outputtext value="Edition"/>
                                               </apex:facet>
                                               {!con.OrganizationEntitle.sfprov__platform__r.name}
                                           </apex:column>
                                           <apex:column width="145px;">
                                               <apex:facet name="header">
                                                   <apex:outputtext value="Status"/>
                                               </apex:facet>
                                               {!con.OrganizationEntitle.sfprov__Version__c}
                                           </apex:column>
                                           <apex:column width="145px;">
                                               <apex:facet name="header">
                                                   <apex:outputtext value="Version"/>
                                               </apex:facet>
                                               {!con.OrganizationEntitle.sfprov__Version__c}
                                           </apex:column>
                                       </apex:pageblocktable>
                                   </apex:repeat>
                             </apex:outputPanel>
                             <br/>
                             
                        
                            
                            <apex:outputpanel rendered="{!IF(item.PackageSet.size>0,true,false)}">
                            <b><div width="150" height="15" style="text-align: center;">&nbsp;<font size="2">Package Entitlements</font></div></b>
                                  <br/> 
                                    <apex:repeat value="{!item.PackageSet}" var="subitem">
                                           <apex:pageblocktable value="{!subitem}" var="con">
                                               <apex:column width="145px;">
                                                   <apex:facet name="header">
                                                       <apex:outputtext value="Definition"/>
                                                   </apex:facet>
                                                   {!con.PackageEntitle.sfprov__Definition__c}
                                               </apex:column>
                                               <apex:column width="145px;">
                                                   <apex:facet name="header">
                                                       <apex:outputtext value="Quantity"/>
                                                   </apex:facet>
                                                   {!con.PackageEntitle.sfprov__Quantity__c}
                                               </apex:column>
                                               <apex:column width="145px;">
                                                   <apex:facet name="header">
                                                       <apex:outputtext value="License Status"/>
                                                   </apex:facet>
                                                   {!con.PackageEntitle.sfprov__EntStatus__c}
                                               </apex:column>
                                               <apex:column width="145px;">
                                                   <apex:facet name="header">
                                                       <apex:outputtext value="Provisioning Status"/>
                                                   </apex:facet>
                                                   {!con.PackageEntitle.sfprov__ProvStatus__c}
                                               </apex:column>
                                               <apex:column width="145px;">
                                                   <apex:facet name="header">
                                                       <apex:outputtext value="End Date"/>
                                                   </apex:facet>
                                                   {!con.PackageEntitle.sfprov__Expiration_Date__c}
                                               </apex:column>
                                           </apex:pageblocktable>
                                   </apex:repeat>
                            </apex:outputpanel>
                            <br/>
                            </div>                          
                </apex:outputPanel>
        </apex:repeat>
   </apex:pageblock>
    
  </apex:form>
</apex:page>

 

 

function customTwistSection(imgElement, showHideDivID){ 
    if($('#'+showHideDivID).is(':visible')){
        $('#'+showHideDivID).hide();
        $(imgElement).removeClass('hideListButton');
        $(imgElement).addClass('showListButton');
    }
    else{
        $('#'+showHideDivID).show();
        $(imgElement).removeClass('showListButton');
        $(imgElement).addClass('hideListButton');
    } 
}

 Please help with this. Thanks in advance...