Pagination,sorting, global search not working with server-side processing in datatable
Pagination,sorting, global search not working with server-side processing in datatable
Hello,
i'm using datatables as below:
.js:
var oatable = $("#DataTable").dataTable( {
"bProcessing": true,
"bServerSide": true,
"bAutoWidth": false,
"destroy": true,
"iDisplayStart":"0",
"iDisplayLength": "10",
"scrollY": "700px",
"scrollCollapse": true,
"sAjaxDataProp": "aaData",
"oLanguage": {
"sSearch": "Filter: "
},
"sAjaxSource": "./sendData",
"sPaginationType": "full_numbers",
"fnServerParams": function ( aoData ) {
aoData.push( { "name": "name", value: name });
},
"fnRowCallback": function( nRow, aData, iDisplayIndex, iDisplayIndexFull ) {
if ((String)(aData["Action"])=="true")
{
$(nRow).css('color', 'grey').css('font-style', 'italic').css('font-size','14px;');
}else{
$(nRow).css('color', 'black').css('font-size','14px;');
}
},
"fnServerData": function ( sSource, aoData, fnCallback, oSettings ) {
oSettings.jqXHR = $.ajax( {
"dataType": "json",
"type": "GET",
"url": sSource,
"data": aoData,
"success": function(data){
fnCallback(data);
}
});
},
"aoColumns": [
{ "mData": "custId"},
{ "mData": "Id",
"sWidth":"6%"},
{ "mData": "name" },
{ "mData": "Date",
"sWidth":"10%"},
]
});
I have set all these variables in the server-side:
iTotalRecords;
iTotalDisplayRecords;
sEcho;
sColumns;
aaData;
I am able to see all the data load onto the table at once,like hundreds at once, but there is no pagination although i can see the right pagination numbers on the left bottom right, I can also see ("1 to 10 out of 200 entries" at the bottom left which is correct). I am also not able to sort or do a global sSearch or paginate. what am i missing?
Any help would be highly appreciated!!