Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

To reapply the default filter selections using TableSorterJS, you can use the refresh() method provided by the plugin. This method refreshes the table with its current settings and data.

Here is an example code snippet:

// Initialize TableSorter
$("#myTable").tablesorter();

// Apply some filter selections
$("#myTable").trigger("search", [{ filters: ["blue", "red"] }]);

// Reapply the default filter selections
$("#myTable").trigger("search", [{ filters: [] }]);
$("#myTable").trigger("filterReset");

In this example, we first initialize TableSorter on the table with $("#myTable").tablesorter(). Then, we apply some filter selections by triggering a search event with the filters option set to ["blue", "red"].

To reapply the default filter selections, we trigger another search event with an empty filters array [{ filters: [] }]. Additionally, we also trigger a filterReset event to clear any filter inputs and reset the filter widget.