mirror of
https://github.com/DataTables/DataTables.git
synced 2025-01-30 23:52:11 +01:00
Dev fix: The sort classes were being applied regardless of sort
and
`sortClasses`
This commit is contained in:
parent
d2755c4037
commit
0142172027
@ -313,6 +313,9 @@ function _fnSortingClasses( settings )
|
|||||||
var classes = settings.oClasses;
|
var classes = settings.oClasses;
|
||||||
var sortIcon = classes.sSortIcon;
|
var sortIcon = classes.sSortIcon;
|
||||||
var sort = _fnSortFlatten( settings );
|
var sort = _fnSortFlatten( settings );
|
||||||
|
var features = settings.oFeatures;
|
||||||
|
var sortFeature = features.bSort;
|
||||||
|
var sortClasses = features.bSortClasses;
|
||||||
var i, ien, col, colIdx, jqTh;
|
var i, ien, col, colIdx, jqTh;
|
||||||
|
|
||||||
// Remove old sorting classes
|
// Remove old sorting classes
|
||||||
@ -344,35 +347,41 @@ function _fnSortingClasses( settings )
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Remove column sorting
|
// Remove column sorting
|
||||||
$( _pluck( settings.aoData, 'anCells', colIdx ) )
|
if ( sortClasses ) {
|
||||||
.removeClass( classes.sSortColumn + (i<2 ? i+1 : 3) );
|
$( _pluck( settings.aoData, 'anCells', colIdx ) )
|
||||||
|
.removeClass( classes.sSortColumn + (i<2 ? i+1 : 3) );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add new ones
|
// Add new ones
|
||||||
for ( i=0, ien=sort.length ; i<ien ; i++ ) {
|
if ( sortFeature ) {
|
||||||
colIdx = sort[i].col;
|
for ( i=0, ien=sort.length ; i<ien ; i++ ) {
|
||||||
col = columns[ colIdx ];
|
colIdx = sort[i].col;
|
||||||
jqTh = $(col.nTh);
|
col = columns[ colIdx ];
|
||||||
|
jqTh = $(col.nTh);
|
||||||
|
|
||||||
// Add base TH sorting
|
// Add base TH sorting
|
||||||
jqTh
|
|
||||||
.removeClass( col.sSortingClass )
|
|
||||||
.addClass( sort[i].dir == "asc" ?
|
|
||||||
classes.sSortAsc : classes.sSortDesc
|
|
||||||
);
|
|
||||||
|
|
||||||
// Add icon sorting
|
|
||||||
if ( sortIcon ) {
|
|
||||||
jqTh
|
jqTh
|
||||||
.find( 'span.'+sortIcon )
|
.removeClass( col.sSortingClass )
|
||||||
.addClass( sort[i].dir == "asc" ?
|
.addClass( sort[i].dir == "asc" ?
|
||||||
classes.sSortJUIAsc : classes.sSortJUIDesc
|
classes.sSortAsc : classes.sSortDesc
|
||||||
);
|
);
|
||||||
}
|
|
||||||
|
|
||||||
// Add column sorting
|
// Add icon sorting
|
||||||
$( _pluck( settings.aoData, 'anCells', colIdx ) )
|
if ( sortIcon ) {
|
||||||
.addClass( classes.sSortColumn + (i<2 ? i+1 : 3) );
|
jqTh
|
||||||
|
.find( 'span.'+sortIcon )
|
||||||
|
.addClass( sort[i].dir == "asc" ?
|
||||||
|
classes.sSortJUIAsc : classes.sSortJUIDesc
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add column sorting
|
||||||
|
if ( sortClasses ) {
|
||||||
|
$( _pluck( settings.aoData, 'anCells', colIdx ) )
|
||||||
|
.addClass( classes.sSortColumn + (i<2 ? i+1 : 3) );
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
settings.aLastSort = sort;
|
settings.aLastSort = sort;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user