i'm building rich datatable dynamic amount of columns. seems me, not big thing, i'm trying answer since hours. issue when want use iteration variable datatable nested loop. in nested loop try create every row same dynamic amount of columns. becomes more clear when show code:
<rich:datatable styleclass="waidatatable" width="700" rowclasses="odd,even" value="#{reportingmodel.reportingdoipoolrows}" var="reportingdoipoolrow" rendered="#{not empty reportingmodel.reportingdoipoolrows}"> <!-- start header of 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 data-table --> <!-- start values of 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 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 in 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) rendered every column inside ui:repeat not rendered. seems can't use reportingdoipoolrow variable iteration. collections use table both type arraylist (long). thank help.
i think <ui:repeat> doesn't work because <rich:column> not ui:repeat designed deal (e.g. <li> or that), <a4j:repeat> should using instead won't work there either (and has way table built).
<c:foreach> work, 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> not have access attributes <rich:datatable> (well, has access rowkeyvar 1) you'll have ask bean directly column size pieces rendered <c:foreach> have access var.
Comments
Post a Comment