Skip to content

Commit 0d92424

Browse files
fix(advance-filtering): remove unnecessary setTimeout functions
1 parent 8bffc2f commit 0d92424

File tree

1 file changed

+15
-19
lines changed

1 file changed

+15
-19
lines changed

projects/igniteui-angular/src/lib/grids/toolbar/grid-toolbar-advanced-filtering.component.ts

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -48,28 +48,24 @@ export class IgxGridToolbarAdvancedFilteringComponent implements AfterViewInit {
4848
this.numberOfColumns = this.extractUniqueFieldNamesFromFilterTree(filteringTree).length;
4949
});
5050
this.grid?.filteringExpressionsTreeChange.subscribe(() => {
51-
setTimeout(() => {
52-
if (this.grid.advancedFilteringExpressionsTree) {
53-
const dataKeys = Object.keys(this.grid.data[0]);
54-
const filteringOperands = this.grid.advancedFilteringExpressionsTree.filteringOperands;
51+
if (this.grid.advancedFilteringExpressionsTree) {
52+
const dataKeys = Object.keys(this.grid.data[0]);
53+
const filteringOperands = this.grid.advancedFilteringExpressionsTree.filteringOperands;
5554

56-
const allOperandsPresent = filteringOperands.every(operand => {
57-
if (operand instanceof FilteringExpressionsTree) {
58-
// Recursively check nested filtering trees
59-
return this.checkFilteringOperands(operand, dataKeys);
60-
} else {
61-
return dataKeys.includes(operand.fieldName);
62-
}
63-
});
64-
65-
if (!allOperandsPresent) {
66-
setTimeout(() => {
67-
this.grid.advancedFilteringExpressionsTree = this.grid.filteringExpressionsTree;
68-
this.numberOfColumns = 0;
69-
});
55+
const allOperandsPresent = filteringOperands.every(operand => {
56+
if (operand instanceof FilteringExpressionsTree) {
57+
// Recursively check nested filtering trees
58+
return this.checkFilteringOperands(operand, dataKeys);
59+
} else {
60+
return dataKeys.includes(operand.fieldName);
7061
}
62+
});
63+
64+
if (!allOperandsPresent) {
65+
this.grid.advancedFilteringExpressionsTree = this.grid.filteringExpressionsTree;
66+
this.numberOfColumns = 0;
7167
}
72-
});
68+
}
7369
});
7470
}
7571

0 commit comments

Comments
 (0)