Columns get mixed up when sorting them after reordering with ColReorder
Columns get mixed up when sorting them after reordering with ColReorder
systembot
Posts: 4Questions: 0Answers: 0
Dear Allan,
if I am right this seems to be a bug of the ColReorder plugin. Sorting jars with reordering. When I reorder the columns using ColReorder and want to sort a reordered column, another column, which is now at the position of the reordered column before reordering it, get sorted. The indices get mixed up although I assigned names to the columns via sName and mDataProp. I suppose this has already been tested against but since I can not figure out the error in my server-side processed implementation of the sorting functionality I assume this might be a bug since I get correct results of the reordering and sorting after reloading the page.
Best regards,
systembot
if I am right this seems to be a bug of the ColReorder plugin. Sorting jars with reordering. When I reorder the columns using ColReorder and want to sort a reordered column, another column, which is now at the position of the reordered column before reordering it, get sorted. The indices get mixed up although I assigned names to the columns via sName and mDataProp. I suppose this has already been tested against but since I can not figure out the error in my server-side processed implementation of the sorting functionality I assume this might be a bug since I get correct results of the reordering and sorting after reloading the page.
Best regards,
systembot
This discussion has been closed.
Replies
Allan
you are completely right. It was not a bug, but the wrong conversion of the index of the column being sorted on to the column position after the reordering. I used the 'mDataProp' column property in the jQuery script and the 'mDataProp_x' GET-parameter in the server-side processing script for the conversion.
Here is the simple way I did the conversion (cf. the condition of the switch-statement):
[code]
for ($i = 0; $i < intval($_GET['iSortingCols']); $i++) { // iterate for each column to be sorted
if ($_GET['bSortable_'.intval($_GET['iSortCol_'.$i])] == "true") { // make sure the column is sortable
switch ($_GET['mDataProp_'.intval($_GET['iSortCol_'.$i])]) { // determine the position of the column to be sorted
case '' : ...; break;
case ...
...
}
}
}
[/code]
Thank you very much for the support and very quick response, Allan.
[code]
/*
* Ordering
*/
if ( isset( $_REQUEST['iSortCol_0'] ) )
{
$sOrder = "ORDER BY ";
for ( $i=0 ; $i