rich dataTable can not use iterate variable for a nested loop

前端 未结 1 735
慢半拍i
慢半拍i 2021-01-14 18:55

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

相关标签:
1条回答
  • 2021-01-14 19:25

    I think <ui:repeat> doesn't work because <rich:column> is not what ui:repeat is designed to deal with (e.g. a <li> or something like that), <a4j:repeat> which you should be using instead won't work there either (and that has something to do with the way the table is built).

    <c:forEach> will work, with a little hack:

    <c:forEach var="index" begin="0" end="#{reportingModel.columns - 1}">
        <rich:column style="text-align:right;">
            <h:outputText value="#{reportingDoiPoolRow.amountOfDois.get(index)}" />
        </rich:column>
    </c:forEach>
    

    <c:forEach> does not have access to the attributes from <rich:dataTable> (well, it has access to rowKeyVar but that will be always 1) so you'll have to ask the bean directly for the column size but the pieces rendered by <c:forEach> will have access to the var.

    0 讨论(0)
提交回复
热议问题