Reputation: 1140
I displaying multiple p:datatable
's through ui:repeat
, the following code snippet illustrates what I am doing:
<ui:repeat id="searchTables"
value="#{searchBean.mapKeys}"
var="mapKeys">
<p:dataTable id="recordTable"
value="#{searchBean.resultMap[mapKeys].resultList}"
var="recordTable"
paginator="true"
rows="10">
<f:facet name="header">
<h:outputText value="#{searchBean.resultMap[mapKeys].name}"/>
</f:facet>
<p:columns value="#{searchBean.resultMap[mapKeys].resultColumns}"
var="column"
columnIndexVar="colIndex">
<f:facet name="header">
<p:outputPanel>
#{column.header}
</p:outputPanel>
</f:facet>
<h:outputText value="#{recordTable[column.property]}"/><br/>
</p:columns>
</p:dataTable>
</ui:repeat>
I need each individual datatable to have its own paginator, however when my page is displayed only the first datatable gets the paginator and this paginator controls all the other displayed DataTables pages..
Thanks for your attention!
Upvotes: 0
Views: 8989
Reputation: 2748
The only way I found was to use two p:datatable tags, the parent one with only one column. I couldn't make it work with p:dataList. I guess p:dataList is extending the same bogus class.
Should work with this:
<p:datatable id="searchTables"
value="#{searchBean.mapKeys}"
var="mapKeys">
<p:column>
<p:dataTable id="recordTable"
value="#{searchBean.resultMap[mapKeys].resultList}"
var="recordTable"
paginator="true"
rows="10">
<f:facet name="header">
<h:outputText value="#{searchBean.resultMap[mapKeys].name}"/>
</f:facet>
<p:columns value="#{searchBean.resultMap[mapKeys].resultColumns}"
var="column"
columnIndexVar="colIndex">
<f:facet name="header">
<p:outputPanel>
#{column.header}
</p:outputPanel>
</f:facet>
<h:outputText value="#{recordTable[column.property]}"/><br/>
</p:columns>
</p:dataTable>
</p:column>
</p:dataTable>
Upvotes: 3
Reputation: 1109635
This is likely related to JSF issue 1830.
Your best bet is to replace ui:repeat
by another repeater which does its UINamingContainer
job better, for example a <p:dataList>
or even another <p:dataTable>
. The list bullets of <p:dataList>
can be removed by CSS list-style-type: none
.
If that also doesn't work, then it's maybe a bug in PrimeFaces <p:dataTable>
itself.
Upvotes: 3