Core: fix sortRestart preventing sort. Fixes #1072

This commit is contained in:
Rob Garrison 2015-11-04 19:31:02 -06:00
parent d8d5908d41
commit f80d3d4c2c
2 changed files with 27 additions and 2 deletions

View File

@ -1407,8 +1407,8 @@
$header = c.$headers.eq( headerIndx );
// only reset counts on columns that weren't just clicked on and if not included in a multisort
if ( $header[ 0 ] !== tmp &&
( notMultiSort || !$header.is( '.' + ts.css.sortDesc + ',.' + ts.css.sortAsc ) ) ) {
c.sortVars[ col ].count = -1;
( notMultiSort || $header.hasClass( ts.css.sortNone ) ) ) {
c.sortVars[ $header.attr( 'data-column' ) ].count = -1;
}
}
}

View File

@ -632,6 +632,31 @@ jQuery(function($){
});
QUnit.test( 'sort Restart', function(assert) {
assert.expect(1);
var done = assert.async();
c1.sortRestart = true;
$.tablesorter.sortReset( c1, function(){
// 1) click on header one
$table1.one('sortEnd', function(){
// 2) click on header zero
$table1.one('sortEnd', function(){
// 3) click on header one, sortRestart should have set it back to ascending sort
// see #1072
$table1.one('sortEnd', function(){
assert.equal( c1.$headers[1].className.indexOf( ts.css.sortAsc ) > -1, true );
c1.sortRestart = false;
done();
});
c1.$headers.eq(1).click();
});
c1.$headers.eq(0).click();
});
c1.$headers.eq(1).click();
});
});
QUnit.test( 'sort Events', function(assert) {
assert.expect(1);