jquery Datatables - 如何实现服务器端提取和客户端排序 [英] jquery Datatables - how to achieve Server side fetching and Client side sorting

查看:149
本文介绍了jquery Datatables - 如何实现服务器端提取和客户端排序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用数据表插件来处理我们的表。
我们有这种用例,我们需要通过使用bServerSide和sAjaxSource的ajax调用来获取数据(paginated),但是只想对该页面上的数据进行排序,而不是从服务器获取排序的数据,如我们的这个例子是非常昂贵的。

I am using the datatables plugin for processing our tables. We have this use case where we need to fetch the data (paginated)through an ajax call using bServerSide and sAjaxSource but would like to just sort the data on that page rather than fetching the sorted data from the server, as in our case this read would be very expensive.

有可能吗?如果是,请建议如何进行。
提前感谢!

Is it possible to do it? If yes, please suggest how to proceed. Thanks in advance!!

推荐答案

我有几乎相同的运行方式,解决方案一直在流水线 - 没有什么是神奇的,不需要结合其他解决方案。设置管道数量高 - 在我的情况下,我正在抓住五个组的结果(页面*显示结果)向前和向后 - 并相信Datatables将做其余的。

I've got something nearly identical running, and the solution was pipelining all the way--nothing else magical and no need to combine other solutions. Set the pipeline volume high -- in my case I'm grabbing essentially 5 "groups" of results (pages * display results) both forward and backward -- and trust that Datatables will do the rest.

在我的应用程序的一个实例中,我正在处理500万个+记录。是的,这很多我对系统的各种元素进行了大量测试,包括查询,数据库优化,索引和UI模式的使用。所有这一切都指向这个系统是最有效率的情况。对于您的情况,我强烈推荐一些性能监控,无论您的UI决定如何看待(如果有的话)存在瓶颈。在我的500万+记录系统中,我查看大约2-4秒的查询时间和+ 5%的负载每页或排序,这当然是可管理的。我有数百个用户和很多其他流程同时处理,我们在大约6个月前实现了多个DataTables,并没有明显的滞后。

In one instance of my app, I'm dealing with 5 million+ records. Yes, it's a lot. I've done a ton of testing on the various elements of the system, including the queries, the database optimization, indexing, and UI pattern usage. All point to this system being the most efficient possible for the situation. For your case, I'd strongly reccomend some performance monitoring regardless of your UI decision to see what (if any) bottlenecks exist. In my 5 million+ record system, I'm looking at about 2-4 seconds of query time and +-5% load per page or sort, which is certainly manageable. I've got hundreds of users and quite a few other processes to deal with as well simultaneously, and we're seeing no noticeable lag since implementing multiple DataTables about 6 months ago.

从UI的角度来看,只对屏幕上数据进行排序的弱点在于它不直观。当我访问网格上的数千或数百万条记录时,我进行排序或过滤,我希望查看所有可用记录的排序和过滤。这听起来很愚蠢,但请记住,UI设计的科学是关于为用户创建熟悉的模式。

From a UI standpoint, the weakness of sorting only the on-screen data is that it's not intuitive. When I've got access to thousands or millions of records on a grid and I sort or filter it, I expect to see the sort and filter of all the available records. It sounds silly, but remember that the science of UI design is all about creating patterns that are "familiar" to the user.

这篇关于jquery Datatables - 如何实现服务器端提取和客户端排序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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