From a6365b3f699e29795efb950527d173471a336977 Mon Sep 17 00:00:00 2001 From: Allan Jardine Date: Fri, 29 Oct 2010 08:48:13 +0100 Subject: [PATCH] Updated: Server-side processing script for column re-ordering has been updated to take account of sNames parameter which is sent in from DataTables, and also brought up to date with the main server-side processing script. Changed: From the previous commit sNames sent from the client to server is now a comma seperated list of sNames and is always sent regardless of if names are given or not. This matches the sName formatting for the server-to-client return. --- .../server_processing_ordering.php | 204 +++++++++++++----- media/js/jquery.dataTables.js | 7 +- 2 files changed, 156 insertions(+), 55 deletions(-) diff --git a/examples/examples_support/server_processing_ordering.php b/examples/examples_support/server_processing_ordering.php index 4031b0a5..d38bced6 100644 --- a/examples/examples_support/server_processing_ordering.php +++ b/examples/examples_support/server_processing_ordering.php @@ -1,14 +1,77 @@ intval($_GET['sEcho']), + "sColumns" => implode( ',', $aColumns ), + "iTotalRecords" => $iTotal, + "iTotalDisplayRecords" => $iFilteredTotal, + "aaData" => array() + ); + while ( $aRow = mysql_fetch_array( $rResult ) ) { - $sOutput .= "["; - $sOutput .= '"'.str_replace('"', '\"', $aRow['platform']).'",'; - $sOutput .= '"'.str_replace('"', '\"', $aRow['engine']).'",'; - $sOutput .= '"'.str_replace('"', '\"', $aRow['browser']).'",'; - $sOutput .= '"'.str_replace('"', '\"', $aRow['grade']).'",'; - if ( $aRow['version'] == "0" ) - $sOutput .= '"-"'; - else - $sOutput .= '"'.str_replace('"', '\"', $aRow['version']).'"'; - $sOutput .= "],"; + $row = array(); + for ( $i=0 ; $i \ No newline at end of file diff --git a/media/js/jquery.dataTables.js b/media/js/jquery.dataTables.js index c4ffb45e..929818af 100644 --- a/media/js/jquery.dataTables.js +++ b/media/js/jquery.dataTables.js @@ -3158,13 +3158,12 @@ oSettings._iDisplayLength : -1 } ); /* Column names */ + var aNames = []; for ( i=0 ; i