简体   繁体   English

在p:dataTable中激活分页时?

[英]When pagination is activate in p:dataTable?

I am using primefaces 3.2 我正在使用primefaces 3.2

How can I know when the user is pushing one of the pagination button in p:dataTable ? 我怎么知道用户何时按下p:dataTable中的分页按钮之一?

Thanks 谢谢

If you need an ajax behaviour when user changes the page, you can use the following code: 如果用户更改页面时需要ajax行为,则可以使用以下代码:

<p:dataTable value="#{bean.collection}" var="obj" >
      <p:ajax event="page" update="componentsToUpdateOnPage" listener="#{bean.pageListener}" />
      <p:column>
         .. etc..
</p:dataTable>

If you are using a lazy loading data table, you have to override the load() method of LazyDataModel. 如果使用的是惰性加载数据表,则必须重写LazyDataModel的load()方法。 that method is executed on page load, when page changes and also when you sort or filter the datatable. 该方法在页面加载时,页面更改时以及在对数据表进行排序或过滤时执行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM