[SalesForce] Title for each records in pageblocktable

Header for each record in pageblocktable?
For now pageblocksection create a collapsible header above the pageblocktable.

       <apex:pageblocksection title="Order Lines" collapsible="true">
          <apex:pageBlockTable value="{!gp.inv}" var="i">   
                <apex:column >
                   <apex:facet name="header">Status</apex:facet>
                   <apex:outputText value="{!i.invoices__r.status__c}"/>
                </apex:column>  
         </apex:pageBlockTable>
       </apex:pageblocksection>

Is there any possible way to create a header for each record for a pageblocktable?

Best Answer

You can use an apex:repeat to output lots of headers with a table inside each. Here is an example using standard objects where for each Contact there is a table of Cases:

<apex:page standardController="Contact" recordSetVar="cs">
   <apex:pageBlock>
       <apex:repeat value="{!cs}" var="c">
           <apex:pageblocksection title="Contact {!c.Name}" collapsible="true">
               <apex:pageBlockTable value="{!c.Cases}" var="ca">   
                  <apex:column headerValue="Case Status" value="{!ca.Status}"/>  
               </apex:pageBlockTable>
            </apex:pageblocksection>
        </apex:repeat>
    </apex:pageBlock>
</apex:page>
Related Topic