Problem with bProcessing popup. It is always on when I click on datatable links

Problem with bProcessing popup. It is always on when I click on datatable links

the_driver_123the_driver_123 Posts: 1Questions: 0Answers: 0
edited December 2011 in General
Hi all, im a problem with datatable and server side mode.

I have an Html table, so in document ready I have define a DataTable object like the example.

$('#patient_list').dataTable({
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "./my_list.php",
"aoColumns": [
{
"sTitle": "Engine"
},
{
"sTitle": "Browser"
},
{
"sTitle": "Platform"
},
{
"sTitle": "Version",
"sClass": "center"
},
{
"sTitle": "Grade",
"sClass": "center"
}
]

});

Initially, my_list.php contains only a ECHO command with this text (i have take the example )

echo '
{
"sEcho": 1,
"iTotalRecords": "10",
"iTotalDisplayRecords": "10",
"aaData": [
[
"Gecko2366",
"Firefox 1.0",
"Win 98+ / OSX.2+",
"1.7",
"A"
],
[
"Gecko2",
"Firefox 1.5",
"Win 98+ / OSX.2+",
"1.8",
"A"
],
[
"Gecko",
"Firefox 2.0",
"Win 98+ / OSX.2+",
"1.8",
"A"
],
[
"Gecko",
"Firefox 3.0",
"Win 2k+ / OSX.3+",
"1.9",
"A"
],
[
"Gecko",
"Camino 1.0",
"OSX.2+",
"1.8",
"A"
],
[
"Gecko",
"Camino 1.5",
"OSX.3+",
"1.8",
"A"
],
[
"Gecko",
"Netscape 7.2",
"Win 95+ / Mac OS 8.6-9.2",
"1.7",
"A"
],
[
"Gecko",
"Netscape Browser 8",
"Win 98SE+",
"1.7",
"A"
],
[
"Gecko",
"Netscape Navigator 9",
"Win 98+ / OSX.2+",
"1.8",
"A"
],
[
"Gecko",
"Mozilla 1.0",
"Win 95+ / OSX.1+",
"1",
"A"
]
]
}';


It is all ok, but when I click coloumn title or I insert TEXT SEARCH processing dialog come in and never disapper. Why?



';

Replies

  • allanallan Posts: 63,535Questions: 1Answers: 10,475 Site admin
    Your sEcho reply is static (always 1). DataTables uses sEcho as a counter and what gets sent must get sent back. So at the moment, DataTables is requesting draw 2 (sEcho==2), but your are replying with sEcho=1 - so DataTables continues to wait for the data that it has asked for. And wait, and wait... :-)

    So the "fix" is to meet the server-side protocol requirements ( http://datatables.net/usage/server-side ) and have sEcho reply with what was sent.

    Allan
This discussion has been closed.