Skip to content

Commit

Permalink
💩 Reset filters on refresh
Browse files Browse the repository at this point in the history
  • Loading branch information
nguyenank committed Jan 26, 2025
1 parent e7c3c43 commit 9b0c364
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 4 additions & 2 deletions js/table/filter.js
Original file line number Diff line number Diff line change
Expand Up @@ -254,10 +254,12 @@ function addFilter(filter) {
afterFiltersUpdate();
}

export function clearFilters() {
export function clearFilters(setup = false) {
dataStorage.set("filters", []);
createFilterRow(getDetails());
select2Filter();
if (!setup) {
select2Filter();
}
setFilteredRows(getRows());
afterFiltersUpdate();
}
Expand Down
4 changes: 3 additions & 1 deletion js/table/table.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ function setUpTable() {
createPage(getStartRow(), getEndRow());

setUpDeleteAllModal("#delete-all-modal");

clearFilters(true /* setup */);
}

function updateTableFooter() {
Expand Down Expand Up @@ -193,7 +195,7 @@ function createHeaderRow(details) {
.attr("id", "clear-filter-icon")
.attr("class", "bi bi-x-square-fill")
.style("display", "none")
.on("click", clearFilters);
.on("click", () => clearFilters());

const columns = [{ title: "" }, ...details]; // for check box
for (const col of details) {
Expand Down

0 comments on commit 9b0c364

Please sign in to comment.