From 6ebfaba204b09a5058960f617cb8c6cf37854876 Mon Sep 17 00:00:00 2001 From: zhosti Date: Mon, 11 Oct 2021 14:57:51 +0300 Subject: [PATCH] fix(filtering): handle multiple events firing for column of type date #10233 --- .../base/grid-filtering-row.component.ts | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/projects/igniteui-angular/src/lib/grids/filtering/base/grid-filtering-row.component.ts b/projects/igniteui-angular/src/lib/grids/filtering/base/grid-filtering-row.component.ts index 9651d10376b..28aa1107db5 100644 --- a/projects/igniteui-angular/src/lib/grids/filtering/base/grid-filtering-row.component.ts +++ b/projects/igniteui-angular/src/lib/grids/filtering/base/grid-filtering-row.component.ts @@ -29,7 +29,7 @@ import { AbsoluteScrollStrategy } from '../../../services/overlay/scroll'; import { DisplayDensity } from '../../../core/displayDensity'; import { IgxDatePickerComponent } from '../../../date-picker/date-picker.component'; import { IgxTimePickerComponent } from '../../../time-picker/time-picker.component'; -import { PlatformUtil } from '../../../core/utils'; +import { isEqual, PlatformUtil } from '../../../core/utils'; import { Subject } from 'rxjs'; import { takeUntil } from 'rxjs/operators'; @@ -70,14 +70,23 @@ export class IgxGridFilteringRowComponent implements AfterViewInit, OnDestroy { public set value(val) { if (!val && val !== 0) { this.expression.searchVal = null; - this.showHideArrowButtons(); + const index = this.expressionsList.findIndex(item => item.expression === this.expression); + if (index === 0 && this.expressionsList.length === 1) { + this.clearFiltering(); + return; + } } else { + const oldValue = this.expression.searchVal; + if (isEqual(oldValue, val)) { + return; + } + this.expression.searchVal = DataUtil.parseValue(this.column.dataType, val); if (this.expressionsList.find(item => item.expression === this.expression) === undefined) { this.addExpression(true); } + this.filter(); } - this.filter(); } public get displayDensity() {