Reputation: 1
I just want to load data to a table but I have over 600k records so it is taking a lot of time to load this to a table. Currently I'm using datatable like this:
$('#datatablesContacts').DataTable({
responsive: true,
"scrollX": true,
"ajax": 'jsphp/servergetdata.php'
});
But still it's taking a lot of time like it freezes the page. So my question now is how to implement lazy loading in a table / datatable? Or is there any library that I can use to implement lazy loading? I'm using PHP as backend script.
Upvotes: 0
Views: 982
Reputation: 58880
You need to use server-side script that will paginate results and enable server-side processing mode with serverSide: true
.
With PHP you can use ssp.class.php
that is available in /examples/server_side/scripts
folder when you download DataTables library.
There is also a sample script server_processing.php
in /examples/server_side/scripts
folder that shows how to use it.
Upvotes: 0