sorting via ajax problem
sorting via ajax problem
dgm
Posts: 8Questions: 0Answers: 0
I am trying to set up a basic ajax solution, and it works for the initial data set, and when I click next it displays the next data set. This implies that my returned json must be correct.
When I click on a column header though, it shows "processing" but never updates the page. Using firebug, I have verified that a response comes back, and it does in fact show a different dataset sorted in reverse. It appears that the json returning is correct; but the table doesn't update and the "processing" never goes away.
My table and code:
[code]
Model Class
id
Updated By
Action
Created by
jQuery(function(){
var oTable = $('#audits').dataTable({
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "<%= audits_path %>",
"sDom": 'C<"clear">lfrtip',
"oTableTools": { },
"sPaginationType": "full_numbers",
});
});
[/code]
the JSON that is returned but ignored:
[code]
{"sEcho":1,"iTotalRecords":85329,"iTotalDisplayRecords":85329,"aaData":[["User",830,108,"create","02/01/2012 10:37 AM"],["User",724,106,"create","05/19/2011 04:39 PM"],["User",727,null,"create","05/22/2011 07:30 PM"],["User",788,null,"create","07/11/2011 07:57 PM"],["User",194,355,"destroy","03/09/2011 03:59 PM"],["User",253,355,"destroy","01/06/2011 10:39 AM"],["User",345,null,"update","02/22/2011 08:56 AM"],["User",138,138,"update","02/25/2011 11:32 PM"],["User",401,null,"update","02/16/2011 10:35 PM"],["User",933,null,"create","04/08/2012 10:34 PM"]]}
[/code]
What could be going wrong, and how can I help debug this?
When I click on a column header though, it shows "processing" but never updates the page. Using firebug, I have verified that a response comes back, and it does in fact show a different dataset sorted in reverse. It appears that the json returning is correct; but the table doesn't update and the "processing" never goes away.
My table and code:
[code]
Model Class
id
Updated By
Action
Created by
jQuery(function(){
var oTable = $('#audits').dataTable({
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "<%= audits_path %>",
"sDom": 'C<"clear">lfrtip',
"oTableTools": { },
"sPaginationType": "full_numbers",
});
});
[/code]
the JSON that is returned but ignored:
[code]
{"sEcho":1,"iTotalRecords":85329,"iTotalDisplayRecords":85329,"aaData":[["User",830,108,"create","02/01/2012 10:37 AM"],["User",724,106,"create","05/19/2011 04:39 PM"],["User",727,null,"create","05/22/2011 07:30 PM"],["User",788,null,"create","07/11/2011 07:57 PM"],["User",194,355,"destroy","03/09/2011 03:59 PM"],["User",253,355,"destroy","01/06/2011 10:39 AM"],["User",345,null,"update","02/22/2011 08:56 AM"],["User",138,138,"update","02/25/2011 11:32 PM"],["User",401,null,"update","02/16/2011 10:35 PM"],["User",933,null,"create","04/08/2012 10:34 PM"]]}
[/code]
What could be going wrong, and how can I help debug this?
This discussion has been closed.
Replies
[quote]
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.
[/quote]
( http://datatables.net/usage/server-side )
If it isn't that, if you could give us a link to the page, that would be really helpful in order to be able to determine what is going on.
Thanks,
Allan