This week I've been working on implementing Tablesorter. It's a great
Jquery table sorting utility, but I spent quite a bit of time trying
to figure out why I could only sort columns in descending order while
using the pager plugin when I set the header option to disable some
columns. I didn't see anything on here about it so, I thought I would
post my fix / solution.

Below, the incorrect way to do it.

$(document).ready(function() {
    $("#SearchResultsTable").tablesorter({
        // pass the headers argument and assing a object
        headers: {

            0: {
                // disable it by setting the property sorter to false
                sorter: false
            },
            4: {
                // disable it by setting the property sorter to false
                sorter: false
            }
        }
    })
.tablesorter({widthFixed: true, widgets: ['zebra']})
.tablesorterPager({
       container: $("#ctl00_MainContent_pager"),
       positionFixed: false
     }); ;
});

>From what I've discovered, you really need to pass all the parameters
in one pass like below:

$(document).ready(function() {
    $("#SearchResultsTable")
     .tablesorter({
       headers: {0: {sorter: false},6: {sorter: false}},
       widgets: ['zebra']
     })
        .tablesorterPager({
       container: $("#ctl00_MainContent_pager"),
       positionFixed: false
     });
});

Above, I am calling table sorter to disable columns 0 and 6, use the
zebra widget, then call the tablesorter Pager plugin.

Reply via email to