Default Sorting and Searching not working
Default Sorting and Searching not working
$(document).ready(function () {
$.ajaxSetup({
cache: false
});
var gender = null;
var table = $('#studentTable').DataTable({
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "studentService.asmx/GetStudents",
"fnServerData": function (sSource, aoData, fnCallback) {
aoData.push({ "name": "gender", "value": gender });
$.ajax({
"dataType": 'json',
"contentType": "application/json; charset=utf-8",
"type": "GET",
"url": sSource,
"data": aoData,
"success": function (msg) {
var json = jQuery.parseJSON(msg.d);
fnCallback(json);
$("#studentTable").show();
},
error: function (xhr, textStatus, error) {
if (typeof console == "object") {
console.log(xhr.status + "," + xhr.responseText + "," + textStatus + "," + error);
}
}
});
}
,
"aoColumnDefs": [
{ "aaSorting": ["desc", "asc"], "aTargets": [0] }
]
,
"aoColumns": [
{ "aaSorting": ["desc", "asc"] },
null,
null
]
, fnDrawCallback: function () {
$('.image-details').bind("click", showDetails);
}
});
});
This discussion has been closed.
Answers
Thats not much to go on. Typically when the Datatables features aren't working there is a Javascript error stopping the page. Do you have errors in your browser's console?
Kevin
Note that you're using
serverSide, so it should be your server script that's doing all the ordering/filtering/paging/etc.Cheers,
Colin
i am not having any errors in Browsers console..that means there is no error in javascript...but what exactly is happening and why it is not working dont know..
As I said, the server will be doing the work - so check and see what data the server is returning.