severside processing does not work in datatables jquery?

severside processing does not work in datatables jquery?

sridhar1982sridhar1982 Posts: 3Questions: 0Answers: 0
edited April 2014 in DataTables 1.9
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

Replies

  • allanallan Posts: 63,493Questions: 1Answers: 10,470 Site admin
    edited April 2014
    As required in the forum rules, please link to a test case showing the issue: http://datatables.net/forums/discussion/12899/post-test-cases-when-asking-for-help-please-read

    Also - I've deleted your duplicate post. Please follow the forum rules. They really are very simple...

    Allan
  • allanallan Posts: 63,493Questions: 1Answers: 10,470 Site admin
    p.s. your sEcho is wrong. Check the documentation: http://datatables.net/usage/server-side
This discussion has been closed.