server-side processing: columns doesn't sort
server-side processing: columns doesn't sort
harold_crow
Posts: 11Questions: 2Answers: 0
Hello i am using version 1.9.4 with PHP and MySQL. The used script is generic for any table, so, i can tell it which columns has each table.
I have a little problem, i am using server side processing and works fine, but, when i try to sort with any column the table doesn't sort.
Researching and making tests i am not sure what happen, when i look into the answer of my php script (server side process) it returns the data sorted as i need but the table doesn't refresh this changes.
Notes: the table are sorted by the first columns asc always (the first time, i mean the query send the data sorted by the first column)
Here my code (it has some php code but it is the idea)
JS Code:
[code]
$(document).ready(function() {
$('#<?=$bunshin->nombre;?>').dataTable( {
"aaSortingFixed": [[ 0, "asc" ]],
"iDisplayLength": 10,
"bProcessing": true,
"bServerSide": true,
"sDom": 'T<"clear">lfrtip',
"oTableTools": {
"sSwfPath": "/datatables/copy_csv_xls_pdf.swf"
},
"sAjaxSource": "server_processing.php?admin_id=<?=$admin_id;?>",
"fnServerData": function( sUrl, aoData, fnCallback ) {
$.ajax( {
"url": sUrl,
"data": aoData,
"success": fnCallback,
"dataType": "json",
"cache": false
} );
},
"iDeferLoading": <?=$numfilas;?>
});
})
[/code]
when i click on a column to sort, the variables sended to the server are
[quote]sSortDir_0 desc[/quote]
on the second time i click on the column the variable has
[quote]sSortDir_0 asc[/quote]
When i check the query, the query is fine too, but i only see the label "Processing...." but the data doesn't sort, what can i do?
I can't send you a link because this is an admin panel an it is not public yet... but if you need more info i will be glad to share it.
I have a little problem, i am using server side processing and works fine, but, when i try to sort with any column the table doesn't sort.
Researching and making tests i am not sure what happen, when i look into the answer of my php script (server side process) it returns the data sorted as i need but the table doesn't refresh this changes.
Notes: the table are sorted by the first columns asc always (the first time, i mean the query send the data sorted by the first column)
Here my code (it has some php code but it is the idea)
JS Code:
[code]
$(document).ready(function() {
$('#<?=$bunshin->nombre;?>').dataTable( {
"aaSortingFixed": [[ 0, "asc" ]],
"iDisplayLength": 10,
"bProcessing": true,
"bServerSide": true,
"sDom": 'T<"clear">lfrtip',
"oTableTools": {
"sSwfPath": "/datatables/copy_csv_xls_pdf.swf"
},
"sAjaxSource": "server_processing.php?admin_id=<?=$admin_id;?>",
"fnServerData": function( sUrl, aoData, fnCallback ) {
$.ajax( {
"url": sUrl,
"data": aoData,
"success": fnCallback,
"dataType": "json",
"cache": false
} );
},
"iDeferLoading": <?=$numfilas;?>
});
})
[/code]
when i click on a column to sort, the variables sended to the server are
[quote]sSortDir_0 desc[/quote]
on the second time i click on the column the variable has
[quote]sSortDir_0 asc[/quote]
When i check the query, the query is fine too, but i only see the label "Processing...." but the data doesn't sort, what can i do?
I can't send you a link because this is an admin panel an it is not public yet... but if you need more info i will be glad to share it.
This discussion has been closed.
Replies
Allan
I can give you access to the admin panel if you want only tell me how can i send you the access privately
Allan
The problem was on the file server_processsing.php (to process the ajax call)
On my case, i was using the code of the example on this page
[code]
if ( isset( $GET['iSortCol_0'] ) )
{
//$sOrder .= ", ";
for ( $i=0 ; $i