checkChildren in toggleFilter method
This commit is contained in:
parent
d90392f402
commit
8931369d14
@ -37,7 +37,7 @@ export class FilterService {
|
||||
this._refresh$.next(true);
|
||||
}
|
||||
|
||||
toggleFilter(filterGroupSlug: string, key: string): void {
|
||||
toggleFilter(filterGroupSlug: string, key: string, checkChildren = false): void {
|
||||
const filters = this.filterGroups.find(group => group.slug === filterGroupSlug)?.filters;
|
||||
if (!filters) {
|
||||
return console.error(`Cannot find filter group "${filterGroupSlug}"`);
|
||||
@ -53,6 +53,12 @@ export class FilterService {
|
||||
|
||||
if (found) {
|
||||
found.checked = !found.checked;
|
||||
|
||||
if (checkChildren && found.checked) {
|
||||
if (found instanceof NestedFilter) {
|
||||
found.children.forEach(c => c.checked);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.refresh();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user