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

查看:151
本文介绍了如何从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>

推荐答案

您可以像这样将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屋!

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