mirror of
https://github.com/DataTables/DataTables.git
synced 2024-12-02 14:24:11 +01:00
Applying proper CSS classes for sorting to columns
As discussed on the forums here: http://datatables.net/forums/discussion/12736/setting-sortable-with-aocolumndefs-glitched
This commit is contained in:
parent
a5c80d4711
commit
a528bbb6b6
6
media/js/jquery.dataTables.js
vendored
6
media/js/jquery.dataTables.js
vendored
@ -298,21 +298,25 @@
|
|||||||
if ( !oCol.bSortable ||
|
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.sSortingClass = oSettings.oClasses.sSortableNone;
|
||||||
oCol.sSortingClassJUI = "";
|
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.sSortingClass = oSettings.oClasses.sSortable;
|
||||||
oCol.sSortingClassJUI = oSettings.oClasses.sSortJUI;
|
oCol.sSortingClassJUI = oSettings.oClasses.sSortJUI;
|
||||||
}
|
}
|
||||||
else if ( $.inArray('asc', oCol.asSorting) != -1 && $.inArray('desc', oCol.asSorting) == -1 )
|
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.sSortingClass = oSettings.oClasses.sSortableAsc;
|
||||||
oCol.sSortingClassJUI = oSettings.oClasses.sSortJUIAscAllowed;
|
oCol.sSortingClassJUI = oSettings.oClasses.sSortJUIAscAllowed;
|
||||||
}
|
}
|
||||||
else if ( $.inArray('asc', oCol.asSorting) == -1 && $.inArray('desc', oCol.asSorting) != -1 )
|
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.sSortingClass = oSettings.oClasses.sSortableDesc;
|
||||||
oCol.sSortingClassJUI = oSettings.oClasses.sSortJUIDescAllowed;
|
oCol.sSortingClassJUI = oSettings.oClasses.sSortJUIDescAllowed;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user