Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

DataTables - not load all data at once?

I have a question about the JQuery PlugIn DataTables.

My Table have got over 5000 rows and it takes more than 20 sec to load the site, and I don't want that.

I wanted to ask if it is possible to only load the first 10 rows and then with pagination click "next" and it loads the next 10 rows?

I know how to do it with my own php code, but I would like to keep using DataTables.

like image 652
user3566608 Avatar asked Apr 24 '14 19:04

user3566608


1 Answers

Basically for that, it's preferable to use Ajax/server-side processing. Turn on the server-side by adding params below to your datatable javascript:

"bServerSide": true, //turn on server-side processing
"sAjaxSource": "ajax.php" //ajax source

For ajax.php, refer to the sample code here - DataTables server-side processing example

like image 67
navilink Avatar answered Sep 22 '22 14:09

navilink