Reputation: 7805
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
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
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
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
}
}
});
});
Upvotes: 6