Change count of displaing items in paginate section

随声附和 提交于 2020-01-05 02:31:58

问题


Is there any way to change count of displaying beans into paginate section by user in grails 2x? I can not find this in grails docs. It means something like (see itemsPerPage)

<g:paginate total="${beanInstanceTotal}" itemsPerPage="[10,20,50]" .../>

I think that this is obvious functionality for pagination.


回答1:


Check the max parameter in g:paginate.

From the docs:
max (optional) - The number of records to display per page (defaults to 10). Used ONLY if params.max is empty

You can then parse params.max in the controller and pass it to the query.

EDIT:
I'm sorry, I misunderstood your question. The combo box you described is not available in the default <g:paginate> tag. I had this same issue in my application and implemented the select item with the awesome Remote Pagination plugin. Usage is described in the docs.

<util:remotePaginate controller="book" action="filter" total="${Book.count()}" update="listTemplateDivId"
              max="20" pageSizes="[10:'10 Per Page', 20: '20 Per Page', 50:'50 Per Page',100:'100 Per Page']"/>


来源:https://stackoverflow.com/questions/14436579/change-count-of-displaing-items-in-paginate-section

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!