Howdy_McGee Howdy_McGee - 4 months ago 35
Javascript Question

Tablesorter - Remove Filter From Columns

I want to exclude certain columns from filtering - much like I can with sorder but I'm not sure how to do that with the widget, is there an easy way to do this?

jQuery(document).ready(function($) {

$("#eventTable").tablesorter({
widthFixed : true,
widgets: ["filter"],

widgetOptions : {
filter_childRows : false,
filter_hideFilters : false,
filter_ignoreCase : true,
filter_cssFilter : 'tablesorter-filter',

filter_functions : {
1 : function(e, n, f, i) {
return e === f;
}
}
}
});
});

Answer

You can use either the header option or add the "filter-false" class to the TH tag for that column.

The header option is documented in the tablesorter documentation - click on "headers" in the property column of the configuration table. The syntax for the option is:

headers: { 0: { filter: false} }

Use the following CSS if you don't want to show the default disabled filter formatting:

.tablesorter thead .disabled {display: none}

Comments