Datatables Server Side processing with jason data..
Datatables Server Side processing with jason data..
I am new to here and trying to implementing Datatables with server-side processing, with ajax, below I have given my code,
function loadTable(){
tableObj = $("#example_List");
sud = $.ajax({
type: 'GET',
url: '/user/search',
dataType: 'json',
data : {"sortBy": '', 'offSet': '1', 'limit' : 10, 'keyword':'', 'order': 1},
success:function(serviceResponse){
tableLoadObj(serviceResponse);
}
});
function tableLoadObj(responseObject){
payloadJSON = responseObject.userModels;
headerCols = [{"mDataProp": "firstName",'sWidth': '100px', 'sTitle': 'First Name'},
{ "mDataProp": "lastName",'sWidth': '100px', 'sTitle': 'Last Name'},
{ "mDataProp": "email",'sWidth': '100px', 'sTitle': 'Email'},
{ "mDataProp": "gender",'sWidth': '100px', 'sTitle': 'Gender'}]
dtObj = initDataTable(tableObj, responseObj, headerCols);
}
..................................................................................................................................
function initDataTable(tableObj, responseObj, headerColumns){
var payloadJSON = responseObj;
var dataTable = $(tableObj).dataTable({
"pagingType": "full_numbers",
"iTotalPages":responseObj.count
"aaData": payloadJSON,
'aoColumns': headerColumns
});
return dataTable;
}
here I am unable to get the Pages for pagination as per the total count of record and also unable to put the server-side sort
please help to go forward
Thanks