Skip to content

Commit 64c15e1

Browse files
committed
fix(filtering): Fix issue when switch conditions #6519
1 parent 4b8e80d commit 64c15e1

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

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

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -462,12 +462,14 @@ export class IgxGridFilteringRowComponent implements AfterViewInit {
462462
this.expressionsList[0].expression.searchVal === null &&
463463
this.expressionsList[0].expression.condition.isUnary === false) {
464464
this.filteringService.getExpressions(this.column.field).pop();
465+
466+
this.filter();
465467
} else {
466-
this.expressionsList.forEach((item) => {
467-
if (item.expression.searchVal === null && !item.expression.condition.isUnary) {
468-
this.filteringService.removeExpression(this.column.field, this.expressionsList.indexOf(item));
469-
}
470-
});
468+
const condToRemove = this.expressionsList.filter(ex => ex.expression.searchVal === null && !ex.expression.condition.isUnary);
469+
if (condToRemove && condToRemove.length > 0) {
470+
condToRemove.forEach(c => this.filteringService.removeExpression(this.column.field, this.expressionsList.indexOf(c)));
471+
this.filter();
472+
}
471473
}
472474

473475
this.filteringService.isFilterRowVisible = false;
@@ -766,12 +768,6 @@ export class IgxGridFilteringRowComponent implements AfterViewInit {
766768
}
767769

768770
private conditionChangedCallback() {
769-
if (this.expressionsList.length > 0 && !this.expression.searchVal && !this.expression.condition.isUnary) {
770-
const selectedItem = this.expressionsList.find(ex => ex.isSelected === true);
771-
if (selectedItem) {
772-
this.value = null;
773-
}
774-
}
775771
if (!!this.expression.searchVal || this.expression.searchVal === 0) {
776772
this.filter();
777773
} else if (this.value) {

0 commit comments

Comments
 (0)