p:dataTable with unknown number of columns

UI Components for JSF
Post Reply
MechanicalWolf
Posts: 6
Joined: 04 Aug 2010, 14:31

04 Aug 2010, 14:40

Hello!
I`m trying to make a dataTable, in wich i don`t know the number of columns and rows.
I got a list dataFieldGroups, wich contains the rows - a list fieldValuesList
fieldValuesList contains a String field value
dataFields - is just a list of String names of columns

so i need the table like:
Column1 | Column2 | Column3 <- List<String> dataFields = {"Column1","Column2","Column3"}
------------------------------------------------
Value1.value |Value2.value|Value3.value <- List<FieldValue>fieldValuesList ={Value1,Value2,Value3}


And here is the code:

<p:dataTable value="#{directoryBean.dataFieldGroups}" var="fg" rowIndexVar="j">

<c:forEach items="#{fg.fieldValuesList}" var="fv" varStatus="i">
<p:column>
<f:facet name="header">
<h:outputText value="#{directoryBean.dataFields[i.count -1]}" />
</f:facet>
<h:outputText value="#{fv.value}" />
</p:column>
</c:forEach>
</p:dataTable>

the problem is, that nothing is displayed.. When i tryed the same with all List<String> it worked, but with objects - not

wobblycogs
Posts: 47
Joined: 19 Apr 2010, 19:09
Location: Gloucester, UK

04 Aug 2010, 21:05

PF currently doesn't support dynamic columns in a data table (see, and maybe vote for, bug 491 - http://code.google.com/p/primefaces/iss ... ail?id=491). Hopefully this will be added for version 2.2 which is due out towards the end of the month.
PrimeFaces 3.0.1, Mojarra 2.1.3, GlassFish 3.1.1, Netbeans 7.0, Firefox 7

MechanicalWolf
Posts: 6
Joined: 04 Aug 2010, 14:31

05 Aug 2010, 09:33

thank you for info.
is there any chance to use Rich Faces dynamic table in Prime faces project?

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

05 Aug 2010, 11:17

Sure they are compatible libraries.

p:columns is coming soon in 2.2. release by the way, as this release will introduce the new datatable with tons of new features and enhancements.

http://code.google.com/p/primefaces/iss ... ail?id=491

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 54 guests