I have code such as the following:
<apex:dataTable value="{!myContacts}" var="c" columns="3">
<apex:column>
<apex:outputText value="{!c.FirstName}"/><br />
<apex:outputText value="{!c.LastName}"/><br />
<apex:outputText value="{!c.Email}"/><br />
</apex:column>
<br />
</apex:dataTable>
This will display something like:
John
Smith
js@example.com
Sue
Jones
sjo@example.com
Joe
Mack
jma@example.com
Jane
Doe
jd@example.com
I want to display myList across N (e.g., 3, 4, etc.) different columns, so that the result is like the following (N=3 in this case). Note that the number of columns is not the same as the number of items on the list.
John Sue Joe
Smith Jones Mack
js@example.com sjo@example.com jma@example.com
Jane
Doe
jd@example.com
How can this be done? Preferably there's just some attribute of apex:dataTable
or other apex component tag staring me in the face that I'm missing.
Note that specifying columns="3"
on the apex:dataTable
has no effect — still just one column.
Thanks.
Best Answer
Unless you need to use the datatable tag for some other reason, this could be done with
<apex:repeat>
and htmltable
tags: