Skip to content

Commit

Permalink
chore: reset facet selection when column is hidden
Browse files Browse the repository at this point in the history
  • Loading branch information
katharinawuensche committed Nov 5, 2024
1 parent fa6ae01 commit df5ae77
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions components/data-table/data-table-filter-columns.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ function toggleCategory(category: Column<never>) {
default:
targetVisibility = true;
}
category.columns.forEach((c) => c.toggleVisibility(targetVisibility));
category.columns.forEach((c) => {
c.toggleVisibility(targetVisibility);
if (!targetVisibility) c.setFilterValue([]);
});
}
const isCollapsibleOpen = ref(columns.value.map(() => false));
Expand Down Expand Up @@ -77,7 +80,12 @@ const visibilityToIcon: Record<visibilityState, Component> = {
:key="column.id"
:checked="column.getIsVisible()"
@select.prevent
@update:checked="(value) => column.toggleVisibility(!!value)"
@update:checked="
(value) => {
column.toggleVisibility(!!value);
column.setFilterValue([]);
}
"
>
{{ column.columnDef.header }}
</DropdownMenuCheckboxItem>
Expand Down

0 comments on commit df5ae77

Please sign in to comment.