简体   繁体   中英

Tablesorter hide filters of hidden columns

I'm trying to use the tablesorter plugin in my html table.

The issue is that I have some "display:none" columns that only are shown if I click a toggle button (my table is very long and I need this functionality).

The problem is that Tablesorter don't hide the filters of the hidden columns.

在此输入图像描述

What I need is to display:none the filters that its TH is already display:none.

Thank you and ask me if you need further details.

There are several methods to hide the filter cells:

  • Whatever class you are adding to hide the column, include it in the filter_cellFilter option in an array.

     // hiding second & fourth columns using associated css filter_cssFilter : [ '', 'hidden', '', 'hidden' ] 
  • Use the following css to hide the entire column instead of adding a class to each cell within the column

     #mytable th:nth-child(10), #mytable td:nth-child(10), #mytable th:nth-child(11), #mytable td:nth-child(11), #mytable th:nth-child(12), #mytable td:nth-child(12) /* etc */ { display: none; } 

I am also curious as to why you would need so many hidden columns. It is also possible to add the extra values in data-attributes, then with some special parsing you can sort or filter using that extra data.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM