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.
Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss
Asked: 2022-04-19 11:00:00 +0000
Seen: 7 times
Last updated: Jan 27 '23
How can a specific "collection" be filtered from a JSON fetch?
How can custom cell filtering be implemented in MUI X?
What is a fast way to locate a distinct value in a spreadsheet without relying on VLOOKUP?
How to make a personalized filter for DataGridPro while looping through a collection of items?
What are the steps for conducting a precise search and filter using sequelize in node.js?
How can I apply a filter to the "Name" Column in a SharePoint Document Library?
In this scenario, what is the method to output the filter array?