Server side processing doesn't redraw table

Server side processing doesn't redraw table

dymissydymissy Posts: 2Questions: 0Answers: 0
edited April 2014 in DataTables
I'm using DataTables in its latest version on ZF1.1 application. At the beginning I used the library without server side processing but actually the number of rows are about 2k so I decided to use the library with server side processing and this is the code I'm using:
var oTable = $('.datatableajax').dataTable({
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "/quote/fetch",
"aaSorting": sorting,
"aoColumns": cols,
"iDisplayLength": 100,
"oLanguage": {
"sSearch": "Cerca in tutte le colonne:"

The server returns a valid JSON (checked and validated with JSON lint), something like the following:

"sEcho": true,
"iTotalRecords": 100,
"iTotalDisplayRecords": 51,
"aaData": [
" ",
"My Company",
"John Doe",
" "
//other results.....

When I load the page the table is drawed fine without problems and with correct data but when I try to filter or order the table, so in other words when I launch a new Ajax call that requires to redraw the table with new data, the table doesn't work and the message "Processing..." doesn't disapper.

I checked in Chrome Network tab the XHR call and it returns a valid JSON with valid data filtered so the server queries work fine. Anyway I can't figure out why the "Processing..." message is still displayed and the table contains old data. I even checked the Chrome console and no errors are logged.

Unfotunately the application is password protected so I cannot provide a working link.

Any suggestion about the nature of the issue?



  • allanallan Posts: 58,315Questions: 1Answers: 9,332 Site admin
    > "sEcho": true,

    That's not an expected server-side processing response. From the documentation ( ):

    > sEcho - An unaltered copy of sEcho sent from the client side. This parameter will change with each draw (it is basically a draw count) - so it is important that this is implemented. Note that it strongly recommended for security reasons that you 'cast' this parameter to an integer in order to prevent Cross Site Scripting (XSS) attacks.

    I very much suspect that is the issue.

  • dymissydymissy Posts: 2Questions: 0Answers: 0
    edited April 2014
    Hello Allan,
    you're right. The value was returned as boolean value, that was the issue.

    Solved! Thanks a lot! :)
This discussion has been closed.