How can I get the number of results after filtering in a paged DataTable in PrimeFaces?
<p:dataTable id="tbl" var="x" value="#{dbBean.xSorted}" paginator="true" rows="20">
<p:column sortBy="#{x.id}" filterBy="#{x.id}" filterMatchMode="exact">
<f:facet name="header">
<h:outputText value="ID" />
</f:facet>
<h:outputText value="#{x.id}" />
</p:column>
</p:dataTable>
The table has ~20 columns which can be sorted and filtered.
Use the currentPageReportTemplate
attribute of the p:dataTable
component:
<p:dataTable id="tbl" var="x"
value="#{dbBean.xSorted}" paginator="true" rows="20"
currentPageReportTemplate="(Displaying {startRecord} - {endRecord} of
{totalRecords}, Page: {currentPage}/{totalPages})">
...
</p:dataTable>
The text outside curly brackets can be changed.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With