如何动态更新PrimeFaces数据表的页面大小? [英] How do you update the page size of a PrimeFaces datatable dynamically?
问题描述
在数据表显示在页面上之后,我试图动态更新PrimeFaces数据表的页面大小,但我似乎无法做到这一点.如果这很重要,我正在使用延迟加载的数据表...将EL表达式放在rows属性中并进行表刷新不起作用,并且会使分页器不返回任何数据.
I am trying to update the page size of a PrimeFaces datatable dynamically, after the datatable is displayed on the page but I can't seem to be able to do that. I am using a lazy loaded datatable if that matters... putting an EL expression in the rows attribute and doing a table refresh does not work and causes the paginator to return no data.
有什么想法可以解决这个问题吗?
Any ideas if this is a bug and how to fix it?
谢谢
推荐答案
您无需刷新或更新数据表.在<p:dataTable>
的rowsPerPageTemplate
属性中使用EL表达式,并在加载数据表后只需更改行号即可.
You need not refresh or update the datatable. Use EL expression in rowsPerPageTemplate
attribute of <p:dataTable>
and after loading datatable just change the rows number.
<p:dataTable value="#{managedBean.users}" var="user" lazy="true" paginator="true" rows="10" rowsPerPageTemplate="10,25 #{fn:length(managedBean.users)}">
并在页面中包含此xmlns:fn="http://java.sun.com/jsp/jstl/functions"
.
这篇关于如何动态更新PrimeFaces数据表的页面大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!