简体   繁体   English

在jquery数据表中呈现大型服务器端数据集

[英]rendering large server-side datasets in jquery datatables

I'm using DataTables 1.9.4 with few plugins (ColVis, ColReorderWithResize and ColumnFiltering). 我正在使用带有几个插件(ColVis,ColReorderWithResize和ColumnFiltering)的DataTables 1.9.4 The parameters I'm using for server-side communication are: 我用于服务器端通信的参数是:

  • "bServerSide" “bServerSide”
  • "fnServerData" “fnServerData”
  • "sAjaxSource" “sAjaxSource”

Now, let's say I have to display 3000 rows with around 25 columns without pagination ("iDisplayLength": -1). 现在,假设我必须显示3000行,其中25列左右没有分页(“ iDisplayLength”:-1)。 The json containing the data weights around 1MB and it takes around second for server to send it to datatables. json包含大约1MB的数据权重,服务器将其发送到datatables大约需要一秒钟。

The problem is the rendering of those 3000 rows take few seconds (around 5-10, which is unacceptable). 问题在于渲染这3000行需要几秒钟(大约5-10,这是不可接受的)。 On IE, it can take quite more, resulting in "Script doesn't respond" errors. 在IE上,它可能花费的时间更多,从而导致“脚本不响应”错误。

I wish I could speed this process up somehow - ie by showing lets say 100 rows and rendering the rest in background. 我希望可以以某种方式加快此过程的速度-即通过显示100行并在背景中渲染其余行。 Is there a better way? 有没有更好的办法? I know there's a Scroller plugin - Scroller , but I need all the data available for searching, so scrolling is not an option. 我知道有一个Scroller插件-Scroller ,但是我需要所有可用于搜索的数据,因此滚动不是一种选择。

unfortunately, datatables aren't made for large dataset. 不幸的是,没有为大型数据集创建数据表。 The way around it is to use server side processing. 解决方法是使用服务器端处理。 Which means you need to implement the data to be returned based on the page index. 这意味着您需要基于页面索引实现要返回的数据。

here are the examples: 以下是示例:
http://datatables.net/forums/discussion/2651/alternative-server-side-php-script http://www.datatables.net/examples/server_side/server_side.html http://datatables.net/forums/discussion/2651/alternative-server-side-php-script http://www.datatables.net/examples/server_side/server_side.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM