Hi i'm using jquery data table 1.9.4 for population server side processing tables.The data's are loading correctly. but the pagination is not working as expected. Actually it has more than 30 rows and the next,previous and page numbers not working
var sTableAllCustomers = $('#tblAllCustomers').dataTable({
"bDestroy": true,
"bProcessing": true,
"bServerSide" : true,
"bLenthChange" : false,
"iDisplayLength": 5,
"aLengthMenu": [[5, 10, 25, 50, -1], [5, 10, 25, 50, "All"]],
"sPaginationType" : "full_numbers",
"sAjaxSource" : "loadAllCustomers",
"oLanguage" : {
"sSearch" : "Search By Email ID:"
},
"aoColumns" : [
{"sTitle" : "No.","mData" : null,"aTargets": [ 0 ],
"fnRender" : function(obj) {
var columnIndex = obj.oSettings._iDisplayStart + obj.iDataRow+1
return columnIndex;
}
},
{"sTitle" : "Email ID","mData" : "email", "bSearchable" : true},
{"sTitle" : "Devices","mData" : "device", "bSearchable" : false},
{"sTitle" : "App Edition","mData" : "edition", "bSearchable" : false},
{"sTitle" : "Account Type","mData" : "accountType", "bSearchable" : false},
{"sTitle" : "Activated Date","mData" : "activatedDate", "bSearchable" : false},
{"mData" : "id", "bSearchable": false,
"mRender": function (data, type, full ) {
return '<a id="'+data+'" datakey="'+full['key']+'" class="btnViewMoreInAllCustomers btn tooltipped more color-sec" data-tooltip="More" data-position="left"> <i class="mdi-notification-more"></i></a>';
}
}
],
"fnServerData" : function(sSource, aoData, fnCallback) {
$.ajax({
"dataType" : 'json',
"type" : "GET",
"url" : sSource,
"data" : aoData,
"success" : fnCallback
});
},
});
The server side code
int totalListSize = modals != null ? modals.size() : 0;
CustomerDataTableObject dataTableObject = new CustomerDataTableObject();
// the total data in db for datatables to calculate page no. and
// position
dataTableObject.setiTotalDisplayRecords(totalListSize);
// the total data in db for datatables to calculate page no.
dataTableObject.setiTotalRecords(totalListSize);
dataTableObject.setsEcho(Integer.parseInt(request.getParameter("sEcho")));
dataTableObject.setAaData(modals);
Gson gson = new Gson();
String json = gson.toJson(dataTableObject);