Reputation: 418
I'm trying to create a dataTable with my own data: the code is like this:
<p:dataTable id="bufferData" >
<p:column headerText="Info" style="width:140px;" >
<h:outputText value="Total buffer size" />
<h:outputText value="Entry size" />
<h:outputText value="Number of entries" />
</p:column>
<p:column headerText="R-P Buffer" style="width:140px;">
<h:outputText value="-" />
<h:outputText value="-" />
<h:outputText value="-" />
</p:column>
<p:column headerText="P-W Buffer" style="width:140px;">
<h:outputText value="-" />
<h:outputText value="-" />
<h:outputText value="-" />
</p:column>
</p:dataTable>
but when I run it I see an empty table. I want to see my data, how can I ?
Upvotes: 0
Views: 2495
Reputation: 1263
You have missed few attributes to mention in dataTable
tag.
<p:dataTable id="bufferData" value="#{managedBean.listOfObjects}" var="value">
<p:column headerText="Info" style="width:140px;" >
<h:outputText value="#{value.field1}" />
<h:outputText value="#{value.field2}" />
</p:column>
// Columns .......
</p:dataTable>
Upvotes: 1
Reputation: 7163
You must set the var and value attributes.
<p:dataTable var="car" value="#{dtBasicView.cars}">
//columns
</p:dataTable>
After that, you will need to bind value attribute with your managedbean.
See the doc and example on the datatable showcase.
Upvotes: 1