I need a dynamic number of columns. Richfaces ships it with <rich:columns> in richfaces 3.3.3-final, but for Richfaces 4 they recommend <c:forEach> .
from: Foreach
I can not get it to work correctly. Since I cannot depend on var on a datatable, I cannot figure out how to feed <c:forEach> correct list of columns. (Each line has its own values, but the headers are the same)
Basically, the data I want to display is a list with rows of size x, each row has a list of column values ββwith size y. But how can <c:forEach> tell the bean which row it should, so that I can correct the correct columns?
n / a 4j: repeat
I do not want to reinvent the wheel because I need frozen columns and many other functions. It was considered creating the html table in this way and using jQuery for other functions. However, it would be hopeless to support and work hard.
I also looked at creating from a dynamic bean creating children dynamically, but I don't like it at all. This should be a last resort.
Usage: Tomcat 7, Servlet 3.0, JSF 2.1x - Mojarra, Richfaces 4.x
Update
Good, so I will get some results. However, my headers are not displayed. The values ββare displayed fine, but not the headers. Does some problem make them iterate or something else?
<rich:dataTable value="#{controller.rows}" var="row"> <c:forEach items="#{controller.columns}" var="column"> <rd:column id="name" width="250"> <f:facet name="header"> <h:outputText value="#{row.myArrayList[column].header}" /> </f:facet> <h:inputText value="#{row.myArrayList[column].value}" disabled="#{row.myArrayList[column].open}"/> </rd:column> </c:forEach> </rich:dataTable>
source share