pufAmuf
pufAmuf

Reputation: 7805

make some columns unsortable?

Des anyone know how I can make certain columns unsortable for this Jquery plugin? I cannot seem to find anything about it in the documentation.

Upvotes: 2

Views: 1032

Answers (3)

Lightness Races in Orbit
Lightness Races in Orbit

Reputation: 385144

It's right there under the headers option in the big table on the page you linked to:

An object of instructions for per-column controls in the format: headers: { 0: { option: setting }, ... } For example, to disable sorting on the first two columns of a table: headers: { 0: { sorter: false}, 1: {sorter: false} }

Upvotes: 2

dSquared
dSquared

Reputation: 9825

You will need to use the headers option to make certain columns un-sortable.

$(document).ready(function() { 
    $("table").tablesorter({ 
        // pass the headers argument and assing a object 
        headers: { 
            // assign the secound column (we start counting zero) 
            1: { 
                // disable it by setting the property sorter to false 
                sorter: false 
            }, 
            // assign the third column (we start counting zero) 
            2: { 
                // disable it by setting the property sorter to false 
                sorter: false 
            } 
        } 
    }); 
});

I hope this helps!

Upvotes: 5

zdrsh
zdrsh

Reputation: 1667

You've missed it, here is the code:

$(document).ready(function() { 
    $("table").tablesorter({ 
        // pass the headers argument and assing a object 
        headers: { 
            // assign the secound column (we start counting zero) 
            1: { 
                // disable it by setting the property sorter to false 
                sorter: false 
            }, 
            // assign the third column (we start counting zero) 
            2: { 
                // disable it by setting the property sorter to false 
                sorter: false 
            } 
        } 
    }); 
});

unsortable columns

Upvotes: 6

Related Questions