This content has been marked as final.
Show 3 replies
-
1. Re: Using rich:dataTable to display data from Vectors
rubenrjorge May 8, 2009 2:46 AM (in response to rubenrjorge)<rich:dataTable id="taskList2" width="400" rendered="true" value="#{MatrixBean.main}" var="mainData"> <f:facet name="header"> <rich:columnGroup> <!-- table headers --> ... </rich:columns> </rich:columnGroup> </f:facet> <!-- table data/body --> <rich:columns value="#{TaskListBean.headerList}" var="singleCellData" index="ind"> <h:outputText value="#{mainData[ind]}" /> </rich:columns> </rich:dataTable>
-
2. Re: Using rich:dataTable to display data from Vectors
rubenrjorge May 8, 2009 3:13 AM (in response to rubenrjorge)Found the problem. It was a problem with the backing bean and not JSF, I forgot to add the auxiliary vectors to the main structure :(
Here's the complete backing bean code:public class MatrixBean { private Vector<Vector<String>> main; public Vector<Vector<String>> getMain() { main = new Vector<Vector<String>>(); Vector<String> aux1 = new Vector<String>(); aux1.add("data01"); aux1.add("data02"); aux1.add("data03"); Vector<String> aux2 = new Vector<String>(); aux2.add("dataA"); aux2.add("dataB"); aux2.add("dataC"); main.add(aux1); main.add(aux2); return main; } }
-
3. Re: Using rich:dataTable to display data from Vectors
rubenrjorge May 8, 2009 3:26 AM (in response to rubenrjorge)A small correction to the JSF:
<!-- table data/body --> <rich:columns value="#{MatrixBean.main[ind]}" var="singleCellData" index="ind"> <h:outputText value="#{mainData[ind]}" /> </rich:columns>
The number of data columns rendering was related to the number of header, which didn't make sense. This way it is related to the number of elements in the vector, as it should be.
Hope this helps and thank you to all those who replied to the previous topic.