Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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;
        }
      }
    }
  });
});
like image 647
Howdy_McGee Avatar asked Sep 05 '13 21:09

Howdy_McGee


4 Answers

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}

like image 63
lindon Avatar answered Nov 18 '22 17:11

lindon


You can disable filter and/or sort for a specific column using:

<th data-sorter="false" data-filter="false"></th>
like image 23
Seralto Avatar answered Nov 18 '22 17:11

Seralto


to disable filter for specific column use <th data-filter="false"></th>

to disable sort for specific column use <th data-sorter="false"></th>

combine them to disable both. <th data-sorter="false" data-filter="false"></th>

this will cause the class "disabled" will be applied to the textbox used for filtering. The textbox will be grayed out. if you want to hide the textbox altogether, just add this

<style>
    .tablesorter thead .disabled {
        display:none;
    }
</style>
like image 6
benicillin Avatar answered Nov 18 '22 16:11

benicillin


If you want to hide all filters -before pageload- add this code to your Css file.

.tablesorter-filter-row{
display : none;
}
like image 1
Uzay Avatar answered Nov 18 '22 16:11

Uzay