更改分页部分中显示项目的数量 [英] Change count of displaing items in paginate section

查看:94
本文介绍了更改分页部分中显示项目的数量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有什么方法可以将用户在grails 2x中将bean的显示次数更改为分页部分?我无法在Grails文档中找到它。它意味着类似于(see itemsPerPage)

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

我认为这是明显的分页功能。

解决方案

检查g:paginate中的 max 参数。



文档

max(可选) - 每页显示的记录数(默认为10)。仅当params.max为空时才使用



然后,您可以在控制器中解析 params.max 并将其传递给查询。



编辑:

对不起,我误解了你的问题。您所描述的组合框在默认< g:paginate> 标签中不可用。我在我的应用程序中遇到了同样的问题,并使用令人敬畏的远程分页插件实现了选择项目。用法在文档中有描述。

 < util:remotePaginate controller =bookaction =filtertotal =$ {Book.count()} update =listTemplateDivId
max =20pageSizes =[10:'10每页',20:'20每页',50:'50每页',100:'每页100' ]/>


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.

解决方案

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']"/>

这篇关于更改分页部分中显示项目的数量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆