Skip to content

Commit dffe89f

Browse files
MKirovaMKirova
authored andcommitted
Clear dimension filter when all are selected.
1 parent 3dece48 commit dffe89f

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

projects/igniteui-angular/src/lib/grids/pivot-grid/pivot-filtering.service.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,23 @@ export class IgxPivotFilteringService extends IgxFilteringService {
3030
(grid as any).setupColumns();
3131
}
3232
}
33+
public clearFilter(field: string): void {
34+
this.clear_filter(field);
35+
}
36+
37+
public clear_filter(fieldName: string) {
38+
super.clear_filter(fieldName);
39+
const grid = this.grid;
40+
const config = (grid as IgxPivotGridComponent).pivotConfiguration;
41+
const allDimensions = PivotUtil.flatten(config.rows.concat(config.columns).concat(config.filters).filter(x => x !== null));
42+
const enabledDimensions = allDimensions.filter(x => x && x.enabled);
43+
const dim = enabledDimensions.find(x => x.fieldName === fieldName || x.member === fieldName);
44+
dim.filters = undefined;
45+
grid.filteringPipeTrigger++;
46+
if (PivotUtil.flatten(config.columns).indexOf(dim) !== -1) {
47+
// update columns
48+
(grid as any).setupColumns();
49+
}
50+
}
3351

3452
}

0 commit comments

Comments
 (0)