Datatable of objectlist

UI Components for JSF
Post Reply
smintprime
Posts: 3
Joined: 20 Oct 2014, 10:04

20 Oct 2014, 10:16

Hi, I use Primefaces 5.1,jsf 2.2, Tomcat 7 and I have a question:

I have a list of object , "ObjectA", with a Strings and Objects ("ObjectB,ObjectC") list properties inside, actually y try to show properties :

Code: Select all

<p:accordionPanel id="p:accordionPanel" dynamic="true" cache="true">
			    
				        <p:tab title="A" >
				            <h:panelGrid columns="6" cellpadding="10" id="gridofObjectA">
								<p:dataTable id="data" value="#{Bean.ObjectA.ObjectB}">(ObjectB is a list of objects inside ObjectA)
                                                                     <p:column headerText="A" id="columnA" columnIndexVar="i">							    
								        <h:outputText id="ObjectBText" value="#{objectb[i].text}" />
								    </p:column>etc....
                                                                </p:dataTable>
                                            <h:panelGrid>
                                        </p:tab>
</p:accordionPane>
What are I doing wrong , i need show objectb properties inside a objectAlist

Thanks for advance.

soekris
Posts: 76
Joined: 29 Apr 2013, 16:54
Location: Barcelona

20 Oct 2014, 12:19

Hello

I can't see your var definition, you need to define var. Something like that

Code: Select all

<p:dataTable id="data" value="#{Bean.ObjectA.ObjectB}" var="myObjectB">

    <p:column headerText="Id">
        <h:outputText value="#{myObjectB.objectgetter}" />
    </p:column>

</p:dataTable>
Hope it helps
Primefaces 5.3.X / 6.X
NetBeans 8.1
WildFly 10
Linux Mint & freeBSD

smintprime
Posts: 3
Joined: 20 Oct 2014, 10:04

22 Oct 2014, 07:25

Hello, its work fine, thanks a lot

kukeltje
Expert Member
Posts: 9605
Joined: 17 Jun 2010, 13:34
Location: Netherlands

22 Oct 2014, 09:00

:roll: :cry:

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 23 guests