I'm building a rich datatable with a dynamic amount of columns. It seems to me, that it is not a big thing, but I'm trying to get an answer since hours. The issue is when I want to use the iteration variable from the datatable for a nested loop. In the nested loop I try to create for every row the same dynamic amount of columns. Probably it becomes more clear when I show some code:
<rich:dataTable styleClass="waiDataTable" width="700"
rowClasses="odd,even" value="#{reportingModel.reportingDoiPoolRows}"
var="reportingDoiPoolRow"
rendered="#{not empty reportingModel.reportingDoiPoolRows}">
<!-- Start header of the data-table -->
<f:facet name="header">
<rich:columnGroup>
<rich:column rowspan="2">
<h:outputText value="Pool" />
</rich:column>
<c:forEach items="#{reportingModel.headerList}" var="item">
<rich:column colspan="2">
<h:outputText value="#{item}" />
</rich:column>
</c:forEach>
<rich:column breakRowBefore="true">
<h:outputText value="New" />
</rich:column>
<rich:column>
<h:outputText value="Tot" />
</rich:column>
<c:forEach begin="1" end="#{reportingModel.headerList.size()-1}">
<rich:column>
<h:outputText value="New" />
</rich:column>
<rich:column>
<h:outputText value="Tot" />
</rich:column>
</c:forEach>
</rich:columnGroup>
</f:facet>
<!-- End header of the data-table -->
<!-- Start values of the data-table -->
<rich:column>
<h:outputText value="#{reportingDoiPoolRow.doiPool.name}"></h:outputText>
</rich:column>
<ui:repeat value="#{reportingDoiPoolRow.amountOfDois}" var="amount">
<rich:column style="text-align:right;">
<h:outputText value="#{amount}"/>
</rich:column>
</ui:repeat>
<!-- Start values of the data-table -->
<f:facet name="footer">
<rich:columnGroup>
<rich:column style="text-align:left;">Totals</rich:column>
<rich:column style="text-align:right;">
<h:outputText value="12"></h:outputText>
</rich:column>
<rich:column style="text-align:right;">
<h:outputText value="12"></h:outputText>
</rich:column>
</rich:columnGroup>
</f:facet>
The issue is in the following block:
<rich:column>
<h:outputText value="#{reportingDoiPoolRow.doiPool.name}"></h:outputText>
</rich:column>
<ui:repeat value="#{reportingDoiPoolRow.amountOfDois}" var="amount">
<rich:column style="text-align:right;">
<h:outputText value="#{amount}"/>
</rich:column>
</ui:repeat>
The name (reportingDoiPoolRow.doiPool.name
) is rendered well but every column inside the ui:repeat
is not rendered.
It seems that I can't use the reportingDoiPoolRow variable for another iteration.
The Collections which I use for the table are both from the type ArrayList
(long).
Thank you very much for your help.