Quantcast

Two pagination in one page

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Two pagination in one page

sonuranju
Hi All,

Can I use pagination two times in the same gsp.
I gave different totals depending upon the two list count.
but when i clicks next on one pagination link of the first list
then the second list also moves.
what my doubt is how can i set the params and offset parameters separelty to the <g:paginate> tag

Please help.
-Thanks.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Two pagination in one page

Boney
Of course u can do.

what you need to do is manually set parameters 'max' and 'offset' in the controller and pass in to the gsp.

In the gsp page,
//********************
  <g:paginate action="listL1" total="${noOfRejected}" max="${rejectedMax}" offset="${rejectedOffset}" params="['cameFrom':'Rejected','draftMax':draftMax,'draftOffset':draftOffset]"/>

 *************//
I encountered one problem when implementing two lists in one page, i.e. the paginate component pass the max parameter and offset parameter to the controller only in the name 'max' and 'offset'. What we need to do in the controller is identify from which list we came from and assign relevant max and offset values to the max and offset variables of two lists.

Hope this helps to your problem


sonuranju wrote
Hi All,

Can I use pagination two times in the same gsp.
I gave different totals depending upon the two list count.
but when i clicks next on one pagination link of the first list
then the second list also moves.
what my doubt is how can i set the params and offset parameters separelty to the <g:paginate> tag

Please help.
-Thanks.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Two pagination in one page

jasenj1
This post has NOT been accepted by the mailing list yet.
Dredging this one up as I am trying to do two paginated tables on one page.

Paginate tag source is here on GitHub starting at line 340 when I wrote this.

You'll notice that "offset" and "max" get taken from params, and if they don't exist in params, then the tag attributes are checked - as per the documentation.

My question is why should params take precedence over tag attributes? That seems backwards. If the attribute prefers the param value, it's pretty easy to set some logic to do so. But it's more difficult to strip an unwanted value out of the params; there's no way to override it.

- Jasen.

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Two pagination in one page

jeffpogo
This post has NOT been accepted by the mailing list yet.
Grails works great with datatables.net

If your tables are small, use datatables and forget all the "server" based pagination code -- just send the whole table and let javascript handle the pagination.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Two pagination in one page

jasenj1
This post has NOT been accepted by the mailing list yet.
Unfortunately, my tables are big - multiple thousands of items.

And it's really not very hard to get rid of "offset" and "max". In the controller, do params.remove("offset"). I keep all the paging info in a couple of session variables.

It just seems odd that params takes precedence over the tag attributes.

- Jasen.
Loading...