如何限制 p:dataTable 或 p:dataGrid 中的最大寻呼机项目数?

How to limit max pager item count in p:dataTable or p:dataGrid?

我想限制 p:dataTable or p:dataGrid 的最大寻呼机项目。我认为默认值是 10。我需要将它设置为最多 5 个寻呼机项目。有可能吗?

下面是我的分页模板代码。

        <p:dataGrid styleClass="bodyContent"
            var="item"  value="#{list}" 
            paginatorPosition="bottom" paginator="true" 
            rows="5" lazy="true" columns="1" layout="grid" 
            paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
            rowsPerPageTemplate="5,10,30,60"
            rowIndexVar="index">

下面是屏幕截图。

您可以使用 pageLinks 属性来更改它。你的情况:

<p:dataGrid ... pageLinks="5">