Search code examples
jquerytablesorter

Removing/Re-adding filter options


I already have functionality to initially hide rows containing deprecated information and subsequently allow toggling of showing/hiding these rows. I want the options in the filters to reflect what rows are currently displayed in the table, since there are more deprecated options to filter by than non-deprecated ones.

Non-tablesorter implementation that works: http://jsfiddle.net/X6EBS/1/

My tablesorter code where I tried the above implementation and failed: http://jsfiddle.net/abkNM/3534/

I have come across the

select_filterSource

option, but frankly I don't understand how to use it to do what I need. Thanks!


Solution

  • Two things need to be modified:

    1. Add "tablesorter-infoOnly" class name to the hidden tbody

      <tbody id="hide" class="tablesorter-infoOnly" style="display:none;"></tbody>
      
    2. Add "filter-onlyAvail" to the first header

      <th class="filter-select filter-onlyAvail">AlphaNumeric</th>
      

    Here is an updated demo.