Load first 10 data from API
Load first 10 data from API
Hi Sir,
Just want to ask regarding in API..
I have an API almost 4,000 plus data...
is there possible in DataTable to load first 10 then when i press page 2,
another 10 will load again? without loading all 4,000 plus first before showing
in datatable.
coz in my situation now it will load all 4,000 data for almost 30 seconds before showing in datatable...
Here's my code:
$(document).ready(function(){
var table = $('#example').DataTable( {
dom: 'Bfrtip',
lengthChange: false,
buttons: [ 'copy', 'excel', 'pdf', 'colvis' ],
ajax: {
url: "http://sample/demo"
},
columns: [
{ "data": "Id" },
{ "data": "company_uid" },
{ "data": "refNumber" },
{ "data": "requestFrom" },
{ "data": "requestTo" },
{ "data": "amount" },
{ "data": "requestNetwork" },
{ "data": "requestStatus" },
{ "data": "flag" },
{ "data": "updated_at" },
{ "data": "created_at" }
]
} );
});
Thank You
Replies
Yes, in DataTables that is called server-side processing. You need to have the server do the sorting, filtering and paging - the parameters sent to and from the server are described in the documentation.
See also this section of the documentation for an overview of client-side and server-side processing.
Allan