Datatable Serverside pagination
Datatable Serverside pagination
Hi,
I need to display only 100 records at a time. I get total number of records from the database, but have to display only first 100 records, after reaching 100 records. I should be able to get next 100 from the server.
Each time I execute the database query at the server side, I'm providing start and end rownum to get only 100 records at a time. Should be able to send the rownum values dynamically to get the records from the server.
Also I need to have the table column headers dynamically.
Any immediate help would be appreciated.
$("#searchTableDiv").append('
');
var tableClient = $("#dynaTdaTable").DataTable({
"ajax": {
"type": formObj.attr('method'),
"url": formObj.attr('action'),
"dataType" : 'json',
"data": function(d){
return formData;
},
'dataSrc': function(data){
return data.dataSet;
},
complete:function(){
$('#loadingDiv').hide();
}
},
'columns': [
{'data': 'data.first_name'}
],
"Processing": true,
"ServerSide" : true,
"paging": true,
"recordsTotal": 57
});
Replies
Sounds like you want to use server-side processing with the
pageLength
parameter set to 100.Allan
Hi Allan,
Thanks for response. But pageLength will display number of records per page right? I need to display 10 records per page and have pagination for first 100 records. Once I reach to 10th page, pagination next button should be enabled to get records from 101 to 200.
Thanks
Maybe pipelining would be of interest:
https://datatables.net/examples/server_side/pipeline.html
Kevin