jsf 2 - <rich:dataTable> from listOfMaps -
i have sessionscoped bean has list of maps. attempting <rich:datatable> produced using <a4j:repeat>.
the list of maps being populated correctly, although there no datatable output. reading articles on stack-overflow, think problem may occuring due life-cycle problems or novice understanding of jsf richfaces.
using: tomcat 7, jsf 2.1x - mojarra, richfaces 4.x
here have far;
<rich:datatable value="#{mybean.mymap}" var="map"> <a4j:repeat value="#{mybean.mymap[0].keyset().toarray()}" var="key"> #{map[key]} </a4j:repeat> </rich:datatable> if point in correct direction, appreciated!
answer:
as stated below solution instead use <c:foreach> , use <rich:columns>.
solution:
<rich:datatable value="#{querybean.test}" var="map"> <c:foreach items="#{querybean.test[0].keyset().toarray()}" var="key"> <rich:column style="text-align:left; width:auto;"> <f:facet name="header"> <h:outputtext value="#{key}" /> </f:facet> <h:outputtext value="#{map[key]}" /> </rich:column> </c:foreach> </rich:datatable>
first of <rich:datatable> has contain columns - <rich:column>
assuming want have dynamic table (the number of columns based on length of map) have use <c:foreach> instead of <a4j:repeat>. have answered question while ago, take look.
Comments
Post a Comment