Skip to content
This repository was archived by the owner on Jun 1, 2025. It is now read-only.

Commit c7a8324

Browse files
Ghislain BeaulacGhislain Beaulac
authored andcommitted
fix backend services calling 2x times postProcess
1 parent 35420d6 commit c7a8324

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

src/app/modules/angular-slickgrid/components/angular-slickgrid.component.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,9 @@ export class AngularSlickgridComponent implements AfterViewInit, OnDestroy, OnIn
9494

9595
ngOnDestroy(): void {
9696
this._dataView = [];
97+
this._gridOptions = {};
9798
this.controlAndPluginService.destroy();
98-
this.filterService.clearFilters();
99+
this.filterService.destroyFilters();
99100
this.resizer.destroy();
100101
this.grid.destroy();
101102
}

src/app/modules/angular-slickgrid/services/filter.service.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,16 @@ export class FilterService {
110110
}
111111
}
112112

113+
destroyFilters() {
114+
// we need to loop through all columnFilters and delete them 1 by 1
115+
// only trying to make columnFilter an empty (without looping) would not trigger a dataset change
116+
for (const columnId in this._columnFilters) {
117+
if (columnId && this._columnFilters[columnId]) {
118+
delete this._columnFilters[columnId];
119+
}
120+
}
121+
}
122+
113123
testFilterCondition(operator: string, value1: any, value2: any): boolean {
114124
switch (operator) {
115125
case '<': return (value1 < value2) ? true : false;

0 commit comments

Comments
 (0)