How Send a paging request and use custom total count in serverside table?

How Send a paging request and use custom total count in serverside table?

jimjaegerjimjaeger Posts: 3Questions: 1Answers: 0

I would like use datatables to show a table based on a custom server response (Github)..Everything was fine and I was able to show the result:

DataTable({
responsive : true,
paging : true,
fixedHeader : true,
stateSave : true,
//sAjaxDataProp: 'items',
rowId: 'id',
stateSave : true,
ajax: {
url: "/api/service/scm",
},
"columns": [
{ "title": "ID", "data": "id" },
{ "title": "Name", "data": "name", "defaultContent": "",
"fnCreatedCell": function (nTd, sData, oData, iRow, iCol) {
$(nTd).html("<a href='tel:"+oData.html_url+"'>"+oData.name+"</a>");
}
},
{ "title": "Description", "data": "description", "defaultContent": "" },
{ "title": "Language", "data": "language", "defaultContent": "" },
{ "title": "Private", "data": "private", "defaultContent": "" }
],
});

But now I have to much entries so I have to send a page query parameter to the server to get more data.
Therefore I would like use the datatables paging mechism to only request the data that is required and if the user click next page to send a next page request to get the next data.

How can I do this? How can I customize the datatables parameter for the total count and how can I use datatables to send the next request with an increased page number.

GitHub use the following format as result {"total_count":140,"incomplete_results":false,"items":[]}
and cannot change it. The query parameter for paging are for example per_page=100&page=3

This discussion has been closed.