Hi,
I'm using a datatable with (client side) pagination and I'd need to store the current page number of the table.
What I want is that when the user navigates to another page and then comes back to the page where the datatable is, the table
is on the same page it was before.
I've seen the attribute "page" of the datable and I think it will be useful for this, but I don't know how can I retrieve the page number from the table or, instead, detect the user's clicks on forward and backward buttons.
Can anyone help me?
Thanks a lot!
Keep page number on Datatable
I would guess your best bet is to use jQuery to hook the onclick event for the paginator buttons. You'll probably want to use the proxying pattern shown on the jQuery website to ensure the current functionality attached to the buttons still executes. But you could proxy the onclick, and then add in an Ajax call to your bean.
Hope that gives an idea?
Cheers,
Matt
Hope that gives an idea?
Cheers,
Matt
-
- Prime
- Posts: 18616
- Joined: 05 Jan 2009, 00:21
- Location: Cybertron
- Contact:
Code: Select all
yourdatatableWidgetVar.getPaginator().getPage()
Hello,
By the way, the documenation doesn't mention that paginator is an Yahoo paginator. You can call all available methods on Yahoo paginator http://developer.yahoo.com/yui/docs/mod ... nator.html after you got it with dataTableWidget.getPaginator(). You can even register a callback 'changeRequest' firing with pagination and update all stuff you need via p:remoteCommand in your callback.
By the way, the documenation doesn't mention that paginator is an Yahoo paginator. You can call all available methods on Yahoo paginator http://developer.yahoo.com/yui/docs/mod ... nator.html after you got it with dataTableWidget.getPaginator(). You can even register a callback 'changeRequest' firing with pagination and update all stuff you need via p:remoteCommand in your callback.
PrimeFaces Cookbook (2. edition): http://ova2.github.io/primefaces-cookbook/ Learning Angular UI Development with PrimeNG: https://github.com/ova2/angular-develop ... th-primeng Blog: https://medium.com/@OlegVaraksin
Should it not be
?
Code: Select all
var pagActual = tablaWidget.getPaginator().getCurrentPage();
PrimeFaces Cookbook (2. edition): http://ova2.github.io/primefaces-cookbook/ Learning Angular UI Development with PrimeNG: https://github.com/ova2/angular-develop ... th-primeng Blog: https://medium.com/@OlegVaraksin
-
- Posts: 43
- Joined: 09 Feb 2011, 20:41
Hi,
Did you get this to work?
Do we have to do it in the JavaScript?
In my case, I have a back button on my application to go back to the data table after navigating to the detail page.
How can I set the page value in this case?
what is the yourdatatableWidgetVar object? I tried Widget, which did not work.
Thanks
Vinaya
Did you get this to work?
Do we have to do it in the JavaScript?
In my case, I have a back button on my application to go back to the data table after navigating to the detail page.
How can I set the page value in this case?
Code: Select all
yourdatatableWidgetVar.getPaginator().getPage()
Thanks
Vinaya
SWF 2.2.1/JSF 2.0/Jboss 6.0/Spring3.0/PrimeFace 3.2
-
- Prime
- Posts: 18616
- Joined: 05 Jan 2009, 00:21
- Location: Cybertron
- Contact:
Page attribute works read only at the moment, feel free to create an issue ticket so we can work on this to update the bound value to the page attribute like page="#{bean.value}".
-
- Information
-
Who is online
Users browsing this forum: No registered users and 28 guests