Keep page number on Datatable

UI Components for JSF
phenrir
Posts: 4
Joined: 11 Mar 2011, 16:52

11 Mar 2011, 17:06

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!

phenrir
Posts: 4
Joined: 11 Mar 2011, 16:52

21 Mar 2011, 12:44

Nobody? I'm kinda lost

mattharr
Posts: 20
Joined: 01 Feb 2011, 04:49

21 Mar 2011, 21:27

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

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

21 Mar 2011, 23:31

Code: Select all

yourdatatableWidgetVar.getPaginator().getPage()
Also PrimeFaces datatable does not do client side pagination (it was before), it does ajax pagination only.

User avatar
Oleg
Expert Member
Posts: 3805
Joined: 02 Oct 2009, 09:41
Location: Germany, Black Forest

22 Mar 2011, 10:32

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.
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

User avatar
Oleg
Expert Member
Posts: 3805
Joined: 02 Oct 2009, 09:41
Location: Germany, Black Forest

22 Mar 2011, 12:29

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

phenrir
Posts: 4
Joined: 11 Mar 2011, 16:52

22 Mar 2011, 17:21

That's it !!
Thank you very much ^^

dmantil
Posts: 93
Joined: 14 Jul 2010, 22:30

26 Mar 2011, 21:09

I don't get it...
I'm trying to figure out how to get the datatble page in the backbean like you're explaining but .... i don't understand.
You say you can use the widgervar.getPaginator.getPage(), but how can i pass that value to the bean?

vinayarammohan
Posts: 43
Joined: 09 Feb 2011, 20:41

29 Mar 2011, 16:23

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?

Code: Select all

yourdatatableWidgetVar.getPaginator().getPage()
what is the yourdatatableWidgetVar object? I tried Widget, which did not work.

Thanks
Vinaya
SWF 2.2.1/JSF 2.0/Jboss 6.0/Spring3.0/PrimeFace 3.2

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

30 Mar 2011, 11:48

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}".

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 28 guests