Search code examples
jquerytablesorter

disable descending sort in tablesorter


I've got tablesorter working to my liking with one exception: for one of my columns I would like to disable the ability to do a descending sort. So when someone clicks on this column, the order will always be the same, i.e. in ascending order.

Is there an option for this with tablesorter?


Solution

  • Although the original tablesorter has code for lockedOrder, it can only be used to lock in a descending sort (demo & ref)

    $('table').tablesorter({
        headers : {
            0: { lockedOrder: 1 }
        }
    });
    

    I have a fork of tablesorter which has fixed this issue so that the lockedOrder can be set as either ascending or descending (demo).