Grails:根据页面大小加载数据 [英] Grails: load data according to page size

查看:51
本文介绍了Grails:根据页面大小加载数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个显示数据的视图->在sendig请求发送到后端之后出现的解析的json.

I have a view which displays data ->parsed json which comes after sendig request to back end.

请求参数包含页面广告页面尺寸,其默认值为page = 1,页面尺寸为20.

The request parameters contains page ad page size which defualts to page=1 and page size to 20.

现在我需要一个分页视图,该分页视图允许用户选择每页10条记录,20条记录和100条记录,从而有助于查看记录. 解析后的json数据已经在view中可用. PLz,请帮助我,当用户第一次打开该页面时,应该只显示20条记录,而当他选择100条记录时,应该显示100条记录.

Now i require a pagination in view that helps to see the records by allowing users to select 10 records per page,20 records and 100. The data parsed json is already available in view . PLz, help me what should i do cause when user for the first time opens the page only 20 record should be displayed and when he select 100 record the page it should show 100 records.

推荐答案

我在想您有一个HTML drop down,其中显示20个结果(以及50和100等),然后当他更改此结果时,它应该显示在页面右侧?
为此,您可以为下拉菜单的onChange()事件设置事件处理程序,该事件处理程序将对服务器进行AJAX调用(并将所需的结果数以及偏移量(如果有的话)作为参数传递)-并返回可以显示的结果.
这就是我要做的.

I am thinking that you have an HTML drop down that says 20 results (and 50 and 100 and so on) and then when he changes this, it should show on the page right?
For this you can set an event handler for the dropdown's onChange() event which makes an AJAX call to your server (and passes the number of results required along with the offset if any as parameters) - and returns your results which you can display.
This is how I'd do it.

这篇关于Grails:根据页面大小加载数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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