posted 17 years ago
I need to create a dataTable with variable number of columns, and it would also have variable number of rows.
-----------------------------------
| Yields |
-----------------------------------
TrancID | 14 | 15 | 16 | 17 | 18 |
-----------------------------------
T1 | P1 | P2 | P3 | P4 | P5 |
-----------------------------------
T2 | p1 | p2 | p3 | p4 | p5 |
-----------------------------------
I have TrancID in a list and i iterate it using the datatable iterator. I iterate yields using seam:repeat iterator.
dataTable code in xhtml file:
<rich:dataTable id="TranchvsYield" var="deal" value="#{pricingResultTab1.tranches}">
<f:facet name="header">
<rich:columnGroup>
<rich:column>
<h:outputText value="Tranche"></h:outputText>
<ui:repeat value="#{pricingResultTab1.yields}" var="fan">
<rich:column style="text-align:center">
<h:outputText value="#{fan}" />
</rich:column>
</ui:repeat>
</rich:column>
</rich:columnGroup>
</f:facet>
<rich:columnGroup>
<rich:column >
<h:outputText value="#{deal}" id="trancheId1"></h:outputText>
<ui:repeat value="#{pricingResultTab1.prices}" var="task">
<rich:column style="text-align:center">
<h:outputText value="#{task}" />
</rich:column>
</ui:repeat>
</rich:column>
</rich:columnGroup>
</rich:dataTable>
Here PricingResultTab1 is the bcking entity beans. tranches and yields are lists having T1, T2... and 14, 15, 16... respectively.
The number of rows and columns works fine , but i don't know who to get the prices right, ..p1, p2, p3..
As from the code prices in each row would be same as in first row..
Help needed..
Thanks in advance.