So, Say I have the following visualforce page:
<table width="100%" border="0">
<tr>
<td valign="top">
<apex:pageBlock mode="edit" id="results">
<apex:pageBlockTable value="{!contacts}" var="contact">
<apex:column >
<apex:facet name="header">
email
</apex:facet>
<apex:outputField value="{!contact.email}"/>
</apex:column>
<apex:column >
<apex:facet name="header">
Name
</apex:facet>
<apex:commandLink reRender="detail">{!contact.name}
<apex:param name="id" value="{!contact.id}"/>
</apex:commandLink>
</apex:column>
</td>
</tr>
</table>
and the following corresponding controller:
public List<Contact> contacts = [SELECT name, division, email FROM Contact];
Say I want to break up this table on division (i.e, when there is a new division, I would like a header to be placed in the table that reads the division name, and then the names and emails of all contacts within that division to appear under the header... similar ot this:
[ Division 1 ]
Email Name
.... ...
... ...
... ...
[ Division 2 ]
Email Name
... ...
[ Division 3 ]
Email Name
... ...
etc...
Is there a way to do this inline in the apex pageblock? Or would I have to make a unique pageblock for each division?
Does anyone have an alternate approach I could take to solve this problem?