问题
I'm using DataTables 1.9.4
with few plugins (ColVis, ColReorderWithResize and ColumnFiltering). The parameters I'm using for server-side communication are:
- "bServerSide"
- "fnServerData"
- "sAjaxSource"
Now, let's say I have to display 3000 rows with around 25 columns without pagination ("iDisplayLength": -1). The json containing the data weights around 1MB and it takes around second for server to send it to datatables.
The problem is the rendering of those 3000 rows take few seconds (around 5-10, which is unacceptable). On IE, it can take quite more, resulting in "Script doesn't respond" errors.
I wish I could speed this process up somehow - i.e. by showing lets say 100 rows and rendering the rest in background. 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.
回答1:
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
来源:https://stackoverflow.com/questions/24766749/rendering-large-server-side-datasets-in-jquery-datatables