mirror of
https://github.com/Mottie/tablesorter.git
synced 2025-01-12 15:24:21 +00:00
Core: fix sortRestart preventing sort. Fixes #1072
This commit is contained in:
parent
d8d5908d41
commit
f80d3d4c2c
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user