Page 1 of 1

Datatable of objectlist

Posted: 20 Oct 2014, 10:16
by smintprime
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.

Re: Datatable of objectlist

Posted: 20 Oct 2014, 12:19
by soekris
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

Re: Datatable of objectlist

Posted: 22 Oct 2014, 07:25
by smintprime
Hello, its work fine, thanks a lot

Re: Datatable of objectlist

Posted: 22 Oct 2014, 09:00
by kukeltje
:roll: :cry: