jqgrid分页服务器和客户端 [英] jqgrid pagination server and client side

查看:123
本文介绍了jqgrid分页服务器和客户端的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试构建jqgrid的分页系统,该系统将在客户端和服务器端使用.通过这种方式,我的意思是我想每次从服务器获取100条记录,然后我希望我的客户端管理一个分页,以便每页仅显示10条记录.当我达到100条记录时,服务器端将被触发,并将向客户端提供下一条100条记录.

I'm trying to build my jqgrid a pagination system that will be in the client side and also in the server side . by that i mean that i want to take from the server lets say 100 records each time , and then i want my client side to manage a pagination to show only 10 records each page. when i reach to the 100 record , the server side will be triggered and will give the client side the next 100 records.

这如何实现?我对此问题感到困惑.

how can this be implemented ? i'm kind of confused about this issue.

任何帮助都将得到帮助,

any help will be appritiated,

感谢提前.

推荐答案

我正在研究的一个项目要求执行此操作.我们能够实现一个非常强大的解决方案.在为jqgrid指定数据类型时,其中一个选项是一个自定义函数,用于检索数据.我们使用了一些闭包魔术来创建一个可以跟踪页面缓冲区状态的函数.我们非常小心地支持jqgrid的大多数配置选项,并且我们的功能将从网格配置中获取其配置.我们还查看了jqgrid代码,以便我们正确执行了受支持的事件.我们能够做的最酷的事情是支持分页的预加载方案.在第一个请求中,我们将检索大量记录(在我们的示例中是300个).当用户分页浏览了2/3(200条记录)的数据时,我们将检索原始数据集的1/3(100条记录),将它们添加到缓冲区的末尾,并从表头删除相同的数量.这种预加载在向前或向后进行相同的分页.

A project I was working on had a requirement to do this. We were able to implement a pretty robust solution. When specifying the datatype for the jqgrid one of the options is a custom function that retrieves the data. We used some closure magic to create a function that could keep track of state of the paging buffer. We took care to support most of the config options for jqgrid and our function would get its configuration from the grid config. We also looked at the jqgrid code so that we executed supported events properly. The really cool thing that we were able to do was support a preload scheme for paging. On the first request we would retrieve a large amount of records (in our case it was 300). When the user had paged through 2/3 (200 records) of the data then we would retrieve the 1/3 of the original set(100 records), add them to the end of the buffer and remove the same amount from the front. This preloading worked the same paging forwards or backwards.

这篇关于jqgrid分页服务器和客户端的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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