Permalink
Browse files

Merge pull request #135 from Tiax/master

Fix: The sorting 'none' class was not being correctly assigned to columns which could not be sorted - 12736.
  • Loading branch information...
2 parents a5c80d4 + a528bbb commit c74db5aee635d73e7d80cc11d1572d5446bba677 @DataTables committed Nov 23, 2012
Showing with 6 additions and 2 deletions.
  1. +6 −2 media/js/jquery.dataTables.js
@@ -296,23 +296,27 @@
/* Check that the class assignment is correct for sorting */
if ( !oCol.bSortable ||
- ($.inArray('asc', oCol.asSorting) == -1 && $.inArray('desc', oCol.asSorting) == -1) )
+ ($.inArray('asc', oCol.asSorting) == -1 && $.inArray('desc', oCol.asSorting) == -1) )
{
+ // either sorting is disabled for this column or neither 'asc' nor 'desc' is in the array
oCol.sSortingClass = oSettings.oClasses.sSortableNone;
oCol.sSortingClassJUI = "";
}
- else if ( $.inArray('asc', oCol.asSorting) == -1 && $.inArray('desc', oCol.asSorting) == -1 )
+ else if ( $.inArray('asc', oCol.asSorting) != -1 && $.inArray('desc', oCol.asSorting) != -1 )
{
+ // both, 'asc' and 'desc' are in the array, so it can be sorted both directions
oCol.sSortingClass = oSettings.oClasses.sSortable;
oCol.sSortingClassJUI = oSettings.oClasses.sSortJUI;
}
else if ( $.inArray('asc', oCol.asSorting) != -1 && $.inArray('desc', oCol.asSorting) == -1 )
{
+ // 'asc' is in the array, while 'desc' is not, so the column can only be sorted ascending
oCol.sSortingClass = oSettings.oClasses.sSortableAsc;
oCol.sSortingClassJUI = oSettings.oClasses.sSortJUIAscAllowed;
}
else if ( $.inArray('asc', oCol.asSorting) == -1 && $.inArray('desc', oCol.asSorting) != -1 )
{
+ // 'asc' is not in the array, while 'desc' is, so the column can only be sorted descending
oCol.sSortingClass = oSettings.oClasses.sSortableDesc;
oCol.sSortingClassJUI = oSettings.oClasses.sSortJUIDescAllowed;
}

0 comments on commit c74db5a

Please sign in to comment.