tsorter
tsorter copied to clipboard
Sorting remove existing css classes
Maybe you can add this code to fix the remove existing css classes? (I'm not a JavaScript developer so maybe there is a better way to fix this.) Thanks.
if (that.prevCol === that.column) {
// if already sorted, reverse
// th.className = th.className !== 'descend' ? 'descend' : 'ascend';
th.classList.toggle('ascend');
th.classList.toggle('descend');
that.reverseTable();
}
else {
// not sorted - call quicksort
th.classList.toggle('descend');
if (that.prevCol !== -1 && that.ths[that.prevCol].className !== 'exc_cell') {
// that.ths[that.prevCol].className = '';
that.ths[that.prevCol].classList.remove('descend', 'ascend');
}
that.quicksort(0, that.trs.length);
}