如何完全控制主界面p:dataGrid与支持bean的分页? [英] how to have full controll of primefaces p:dataGrid pagination with the backing bean?

查看:44
本文介绍了如何完全控制主界面p:dataGrid与支持bean的分页?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个素数的p:dataGrid,它在dataGrid的顶部有一个分页.

I have a p:dataGrid of primefaces that has a pagination on top of the dataGrid.

我的目标是完全控制分页按钮,因此当我单击以使某些操作方法与之关联时.有没有人可以向我解释.这是我的主意.

my goal is to have full control of the pagination buttons so when I click to have some action method associated with it. is there anyone that can explain to me. this is my idea.

 <p:dataGrid var="car" value="#{tableBean.cars}" columns="3"  
    rows="12" paginator="true"  
    paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"  
   > 

当我单击{FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink}之一时

when I click one of {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink}

可以从后备Bean中捕获,因此我可以在显示页面之前做一些额外的活动.

to be captured from the backing bean so I can do some extra activity prior displaying the page.

如果任何人也知道如何使用getPaginator()客户端Api并给我举个例子,那么他们的文档中就会提到它,但是没有任何代码片段.

if anyone also know how to use getPaginator() client Api and give me an example would be great on their documentation it mentions it but without any snippets of code.

谢谢.

推荐答案

Primefaces有一个 page 事件,您可以在< p:ajax/> 中使用你会这样吗?

Primefaces has a page event you can use in a <p:ajax/> as you would any other event like so

 <p:ajax event="page" listener="#{tableBean.myListener}" />

将此ajax侦听器附加到数据表以实现所需的结果

Attach this ajax listener to your datatable to achieve the results you want

或者,您可以在素面 LazyDataModel 中实现额外的处理方法 load()方法,请参见示例

Alternatively, you could implement the extra processing load() method in the primefaces LazyDataModel, see an example here

这篇关于如何完全控制主界面p:dataGrid与支持bean的分页?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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