Search code examples
jquerytablesorter

jQuery tablesorter filtering dropdown menus after filtering table


I am using jQuery tablesorter to filter data in a table.

I have 2 columns 'Category' and 'Subcategory' that can be filtered by a dropdown menu, when a 'Category' from the dropdown is selected the data gets filtered but the 'Subcategory' menu still shows all the subcategories.

Is it possible for the subcatgory dropdown to then only leave options from the data that is visable in the table and vice versa?

enter image description here


Solution

  • In the column header, add a class name of filter-onlyAvail (ref).

    You can test it out in this demo in the "Discount" column - filter the other columns and the available selections in the "Discount" column will only show the visible results.