如何从 PrimeFaces 数据表自定义分页器 [英] How to customize the paginator from PrimeFaces datatable

查看:24
本文介绍了如何从 PrimeFaces 数据表自定义分页器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想自定义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>

推荐答案

您可以像这样为 CurrentPageReport 使用 PrimeFaces currentPageReportTemplate:

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆