如何从PrimeFaces数据表中定制分页器 [英] How to customize the paginator from PrimeFaces datatable
问题描述
我想自定义 PrimeFace 的数据表分页.
I want to customize PrimeFace's data table pagination.
当前正在底部显示页数:(1 of 5)
.我想在记录总数中的一页中显示记录数,例如:(1-10 of 50)
.
It is currently showing the page count at the bottom as: (1 of 5)
. I want to display the # of records in one page out of total number of records, such as: (1-10 of 50)
.
我在下面包含了我的代码-但它不起作用.谁能帮忙吗?
I have included my code below - but it isn't working. Could anyone please assist?
<p:dataTable id="tblStatusSearch" var="item" rowIndexVar="rowStatusSearch"
rows="10" paginator="true"
paginatorTemplate="{CurrentPageReport}
{FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} "
value="#{StatusAction.listEBeans}"
<f:facet name="footer">
<h:outputText value="#{rowStatusSearch + 1} - 10 out of #{bondLocationStatusAction.itemCount}"/>
</f:facet>
推荐答案
您可以像这样将PrimeFaces currentPageReportTemplate
用于 CurrentPageReport :
You can use a PrimeFaces currentPageReportTemplate
for the CurrentPageReport like this:
<p:dataTable id="tblStatusSearch" var="item" paginator="true" rows="10"
currentPageReportTemplate="Showing {startRecord}-{endRecord} out of {totalRecords}"
paginatorTemplate="{CurrentPageReport}
{FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} "
value="#{StatusAction.listEBeans}">
我确认它可以在PrimeFaces 3.4.2中使用. PrimeFaces 3.0用户指南中提供了该功能,因此,如果您使用的是PrimeFaces 3.x,则应该可以使用.
I confirm that it works in PrimeFaces 3.4.2. It is present in the users guide for PrimeFaces 3.0, so if you are using PrimeFaces 3.x it should work for you.
这篇关于如何从PrimeFaces数据表中定制分页器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!