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
StenderStender 

Alternate PageBlockSection Header style in a Repeat block.

Hello,

 

I have a VF page that is dynamically displaying pageblockheaders in a repeat section.  I have added a java script to auto-collapse the sections, but the problem is that the outcome of 20 or so collaped page block sections in a row is eye-watering to say the least.  I think that alternating the color of the section headers might help alleviate the problem, but I am unsure how.  Here is a stripped down version of my VF page.  At the top is where I apply the style to all of the pageblocksection headers.

 

<apex:page Controller="CustomOpportunityProductController" >
<style> .pbSubheader{ background-color: #317992 !important; border-color: none !important; } </style>   
        <apex:sectionHeader title="{!$ObjectType.Opportunity_Product__c.label} Edit" subtitle="New {!$ObjectType.Opportunity_Product__c.label}"/>
        <apex:form >        
        <apex:pageBlock title="New {!$ObjectType.Opportunity_Product__c.label}" id="mainPageBlock">
		<apex:pageBlockSection showHeader="true" title="Details" columns="1" collapsible="false" >    
        		****Intermediate code here, not important***
		</apex:pageBlockSection>
		<apex:repeat value="{!categories}" var="currentCategory" rendered="{!showProductSelection}" >
       			<apex:pageBlockSection id="categorySection" showHeader="true" title="Category:  {!currentCategory}" columns="1">
                		<apex:pageBlockTable value="{!separatedPSRecords[currentCategory]}" var="currentPSWrapper" cellpadding="4" border="1" >
					***Details of the repeat table here***
				</apex:pageBlockTable>                       
	                 </apex:pageBlockSection>
			 <script> twistSection(document.getElementById('{!$Component.categorySection}').getElementsByTagName('img')[0]) </script> ***This is the script that collapses the PBS***
                	 <br/>  ***Tried adding this to alleviate the problem, with only minimal effect.                  
		</apex:repeat>		
        </apex:pageBlock>        
        </apex:form>
</apex:page>

 Any help would be appreciated.

 

Thanks,
Jeremy Stender