pagination - grails paginated list not working correctly -


iam implementing search functionality pagination in projext using grails. following code can see first resultset max=5, when click "next" returns no data.

below code snippet: controller code:

list <searchcommand> empdetailslist = searchservice.searchemployee(searchcommand) 

service code:

def userlist = criteria.list(max:searchcommand.max, offset:searchcommand.offset){         userprofiles {             ('firstname', "${searchcommand.firstname}%")                ('lastname', "${searchcommand.lastname}%")         }         employees {             ('employeenum', "${searchcommand.employeenum}%")             ('payenum', "${searchcommand.payenum}%")         }                  }       list <searchcommand> searchcommandlist = new arraylist<searchcommand>()    for(userobject in userlist) {     searchcommand searchcommandobj = new searchcommand()     def user = userobject schemeuser     userprofile userprofile = userprofile.findbyschemeuser(user)     searchcommandobj.firstname =  userprofile.firstname     searchcommandobj.lastname =  userprofile.lastname     println "userprofile.firstname : " + userprofile.firstname     employee emp = employee.findbyuser(user)     searchcommandobj.employeenum =  emp.employeenum     searchcommandobj.payenum =  emp.payenum     searchcommandlist.add(searchcommandobj) } return searchcommandlist 

iam using empdetailslist in gsp pagination.

what need fix gsp correctly displays result pagination when click on 'next'?

i think total parameter paginate tag lib missing. check if using right value tag attribute.

<g:paginate controller="ctrl" action="list" total="${totalvalue}"/> 

you can control max , offset values passed controller. furhtermore can control max , offset url parameters generated paginate links (1,2,...previous, next, ...).


Comments

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -