Reputation: 741
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}"
>
when I click one of {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink}
to be captured from the backing bean so I can do some extra activity prior displaying the page.
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.
Thank you.
Upvotes: 1
Views: 5991
Reputation: 20691
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}" />
Attach this ajax listener to your datatable to achieve the results you want
Alternatively, you could implement the extra processing load()
method in the primefaces LazyDataModel
, see an example here
Upvotes: 2