简体   繁体   中英

DataTables performance for big table

First of all i am very glad to use dataTables - it is easy to use and nice solution if you have to work with tables in HTML pages. When my table was about 700 rows and 10 cols everything was great!

But now my table is about 3000 records (rows) and maybe about 10 rows and performance of search dramatically decreased. I updated version of datatables.js script from 1.9.4 to 1.10.7 - but i see no changes in speed while i am searching for something in my table. I tried it with pagination enabled or disabled - no difference.

What can be done to increase performance and speed of search? I am abolutely sure that 3000 records is not big deal for great library like dataTables!

UPDATE i use it with static page and TableTools add-on. My options are

"sDom": 'T<"clear">lfrtip',
"oTableTools": {***tableTools options**},
"sPaginationType": "full_numbers",
"bPaginate": true,
"iDisplayLength": 30,
"bLengthChange": false,
"bInfo": true,
"oLanguage": { *** some translations *** }

Datatables in the way you are using it is fine if, like you said, you have a small number of records. But if you have many records, a JSON is sent to the client, it is going to be parsed by Datatables and shown in the table, so you should switch to AJAX. Documentation to use Datatables with AJAX can be found here:

https://www.datatables.net/examples/data_sources/ajax.html

Load your data asynchronously, each page retrieval is a new request to the server. That will solve your searching issues (...given you write your queries properly.) :

Datatables server-side processing example.

I'm currently running Datatables for 100k records, no issues here.

Good luck!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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