1
0
mirror of https://github.com/DataTables/DataTables.git synced 2025-01-19 12:52:11 +01:00

Update media/src/core/core.sort.js

Further refinement - stop once all sorting classes have been seen
This commit is contained in:
Tim Tucker 2012-09-03 19:12:03 -03:00
parent 2afa5e4360
commit 6bce847a3b

View File

@ -404,7 +404,7 @@ function _fnSortingClasses( oSettings )
/* Remove the old classes */
if ( oSettings.oFeatures.bDeferRender || nTds.length >= iColumns )
{
{
var reClass = new RegExp(sClass + "[123]");
/* Track columns where we've found one of the sorting classes */
@ -418,15 +418,21 @@ function _fnSortingClasses( oSettings )
/* Check if we've already found the class at least once in this column
*
* If not, check the className of this cell
*
* Stop once we've found all 3 sorting classes
*/
abFound[iTargetCol] = abFound[iTargetCol] || ( nTds[i].className.indexOf(sClass) !== -1 );
if (abFound.length < 3)
{
abFound[iTargetCol] |= nTds[i].className.indexOf(sClass) !== -1;
}
if ( abFound[iTargetCol] )
{
nTds[i].className =
$.trim( nTds[i].className.replace( reClass, "" ) );
}
}
}
}
/* Add the new classes to the table */
var iClass = 1, iTargetCol;