severside processing does not work in datatables jquery?
severside processing does not work in datatables jquery?
sridhar1982
Posts: 3Questions: 0Answers: 0
Here is my code:
$(document).ready(function() {
var oTable = $('#search_table').dataTable( {
"sDom": 'T<"clear">lrtip',
"oTableTools": {
"sSwfPath": "{% static "extras/copy_csv_xls_pdf.swf" %}",
"aButtons": [ "csv", "pdf", "print" ]
},
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "{% url 'search_list_json' %}",
"aaSorting": [ [2,'asc'], [1,'desc'] ],
// Disable sorting for the Actions column.
"aoColumnDefs": [ { "bSortable": false, "aTargets": [ 0,4 ] } ]
} );
} );
Strangely, if comment-out "bServerSide": true", it works fine and my table is displayed nicely in HTML. but when I have it, I get `aData is undefined` error. what is the problem here and how to fix it?
The JSON object returned from server seems fine as per the format. it has aaData
{"result": "ok", "iTotalRecords": 1, "aaData": [["Mazda=>626:2012-1986\n ", "04/07/2014", "10000", "1000", " "]], "sEcho": 0, "iTotalDisplayRecords": 1}
Thanks
$(document).ready(function() {
var oTable = $('#search_table').dataTable( {
"sDom": 'T<"clear">lrtip',
"oTableTools": {
"sSwfPath": "{% static "extras/copy_csv_xls_pdf.swf" %}",
"aButtons": [ "csv", "pdf", "print" ]
},
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "{% url 'search_list_json' %}",
"aaSorting": [ [2,'asc'], [1,'desc'] ],
// Disable sorting for the Actions column.
"aoColumnDefs": [ { "bSortable": false, "aTargets": [ 0,4 ] } ]
} );
} );
Strangely, if comment-out "bServerSide": true", it works fine and my table is displayed nicely in HTML. but when I have it, I get `aData is undefined` error. what is the problem here and how to fix it?
The JSON object returned from server seems fine as per the format. it has aaData
{"result": "ok", "iTotalRecords": 1, "aaData": [["Mazda=>626:2012-1986\n ", "04/07/2014", "10000", "1000", " "]], "sEcho": 0, "iTotalDisplayRecords": 1}
Thanks
This discussion has been closed.
Replies
Also - I've deleted your duplicate post. Please follow the forum rules. They really are very simple...
Allan