1
0
mirror of https://github.com/DataTables/DataTables.git synced 2025-03-15 16:29:16 +01:00

Dev fix: The columning classes should be applied to the columns the user

has selected for sorting, not the data sorted columns (although they are
usually the same)

- https://datatables.net/forums/discussion/18714
This commit is contained in:
Allan Jardine 2013-12-19 14:24:37 +00:00
parent 7477cee42d
commit af287d50a2
2 changed files with 8 additions and 6 deletions

View File

@ -1 +1 @@
059275a51400f3ffac61170fcc4dd0a78be33c1d
72a8f1106b4dd9fca8cb7afb2087c4bb0bf65b87

View File

@ -4096,7 +4096,7 @@
aSort = [],
aiOrig = [],
aoColumns = settings.aoColumns,
aDataSort, iCol, sType,
aDataSort, iCol, sType, srcCol,
fixed = settings.aaSortingFixed,
fixedObj = $.isPlainObject( fixed ),
nestedSort = [],
@ -4129,7 +4129,8 @@
for ( i=0 ; i<nestedSort.length ; i++ )
{
aDataSort = aoColumns[ nestedSort[i][0] ].aDataSort;
srcCol = nestedSort[i][0];
aDataSort = aoColumns[ srcCol ].aDataSort;
for ( k=0, kLen=aDataSort.length ; k<kLen ; k++ )
{
@ -4137,6 +4138,7 @@
sType = aoColumns[ iCol ].sType || 'string';
aSort.push( {
src: srcCol,
col: iCol,
dir: nestedSort[i][1],
index: nestedSort[i][2],
@ -4434,7 +4436,7 @@
if ( features.bSort && features.bSortClasses ) {
// Remove old sorting classes
for ( i=0, ien=oldSort.length ; i<ien ; i++ ) {
colIdx = oldSort[i].col;
colIdx = oldSort[i].src;
// Remove column sorting
$( _pluck( settings.aoData, 'anCells', colIdx ) )
@ -4443,7 +4445,7 @@
// Add new column sorting
for ( i=0, ien=sort.length ; i<ien ; i++ ) {
colIdx = sort[i].col;
colIdx = sort[i].src;
$( _pluck( settings.aoData, 'anCells', colIdx ) )
.addClass( sortClass + (i<2 ? i+1 : 3) );
@ -6139,7 +6141,7 @@
var sortedColumns = {};
$.each( aSort, function (i, val) {
sortedColumns[ val.col ] = val.dir;
sortedColumns[ val.src ] = val.dir;
} );
_fnCallbackFire( oSettings, null, 'order', [oSettings, aSort, sortedColumns] );