gsp - Grails pagination not working -
i've been week trying fix pagination problem, no results,
i have in controller
patientcontroller{ def show(long id) { def patientinstance = patient.get(id) if (!patientinstance) { flash.message = message(code: 'default.not.found.message', args: [message(code: 'patient.label', default: 'patient'), id]) return } def historyinstance = history.findallbypatient(patientinstance) def total = historyinstance.size() [historyinstance: historyinstance,patientinstance: patientinstance,historyinstancetotal: total] } } and have code on view
<g:each in="${historyinstance}" var="historyinstances" status="i"> ... </g:each> <div class="pagination"> <g:paginate total="${historyinstancetotal}"/> </div> i used params, max on <g:paginate>, tried no result shows whole set of history in view.
you need pass params finder you're using, otherwise won't know how paginate. <g:paginate> tag displaying pagination links, not performing pagination. total need use countby because result set limited current page of results.
def historyinstance = history.findallbypatient(patientinstance, params) def total = history.countbypatient(patientinstance)
Comments
Post a Comment