Remove Filter From Columns
Asked Answered
S

4

13

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;
        }
      }
    }
  });
});
Sassaby answered 5/9, 2013 at 21:58 Comment(0)
H
27

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}

Hobbs answered 6/9, 2013 at 14:54 Comment(0)
K
16

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

<th data-sorter="false" data-filter="false"></th>
Kuth answered 10/5, 2016 at 20:32 Comment(1)
I prefer this solution, it's quite easy.Cuprite
F
6

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>
Friedcake answered 14/7, 2016 at 18:14 Comment(0)
L
2

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

.tablesorter-filter-row{
display : none;
}
Leaseback answered 28/1, 2019 at 23:42 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.