Reputation: 90493
Is it possible to dynamically generate pairs of columns using RichFaces' rich:columns
component? (Version 3.3.0)
Ideally, I'd like to generate something resembling the following:
+------+--------------+--------------+---------------
| Name | 1/2/09 | 2/2/09 | 3/2/09 (etc.)
+------+------+-------+------+-------+-----------
| .... | Time | Value | Time | Value |
+------+------+-------+------+-------+-------
| .... | Time | Value | Time | Value |
... that is, a single header cell per column-pair, with the two columns underneath. However, the combined header is not that important.
I've consulted the docs, and while they suggest that a colspan
can (somehow) be used, they don't offer any examples.
Any help appreciated!
Upvotes: 3
Views: 2302
Reputation: 597114
Try the following. Have in mind that oneElementCollection should be a collection that contains just one row of an object DaysData
, which has the List
of days in it.
<rich:dataTable value="#{oneElementCollection}" var="daysData">
<a4j:repeat value="#{daysData.days}" var="day">
<rich:subtable value="#{day.infos} var="info">
<f:facet name="header">
<h:outputText="#{day.display}" />
</f:facet>
<rich:column>
<f:facet name="header">
<h:outputText="time" />
</f:facet>
<h:outputText value="#{info.time}" />
</rich:column>
<rich:column>
<f:facet name="header">
<h:outputText="value" />
</f:facet>
<h:outputText value="#{info.value}" />
</rich:column>
</rich:subtable>
</a4j:repeat>
</rich:dataTable>
Upvotes: 2