grails - Maintaining page number across requests -
i have button on client side , when press, execute action on server , call list method again. works fine let's i'm on page 3 , click item, when page refreshes takes me page 1. don't know page i'm on. there way maintain page number?
you need pass offset
, max
parameters through request. can pass current params link tag, if you're using it:
<g:link action="myaction" params="${[offset: params.offset, max: params.max]}"/>
if you're not using <g:link>
, can make them query parameters in href:
<a href="/path/to/action?max=${params.max}&offset=${params.offset}">link</a>
these params need make .list()
method in controller (e.g. .list(params)
).
as long params set in action renders resulting view, <g:paginate>
tag pick them , render pagination links correctly.
Comments
Post a Comment