Skip to content

Commit 40c676e

Browse files
committed
fix(fitltering): Fix dateTime column filter #5627
1 parent 4f9d0a7 commit 40c676e

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
(onSelection)="onDateSelected($event)"
5151
(onClose)="datePickerClose()">
5252
<ng-template igxDatePickerTemplate let-openDialog="openDialog">
53-
<igx-input-group #dropDownTarget type="box" [displayDensity]="'compact'" [supressInputAutofocus]="true">
53+
<igx-input-group #dropDownTarget type="box" [displayDensity]="'compact'" [supressInputAutofocus]="true" (focusout)="onInputGroupFocusout()">
5454
<igx-prefix #inputGroupPrefix
5555
tabindex="0"
5656
(click)="toggleConditionsDropDown(inputGroupPrefix)"

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

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,9 @@ export class IgxGridFilteringRowComponent implements AfterViewInit {
129129
@ViewChild('inputGroup', { read: ElementRef, static: false })
130130
protected inputGroup: ElementRef;
131131

132+
@ViewChild('dropDownTarget', { read: ElementRef, static: false })
133+
protected inputGroupDate: ElementRef;
134+
132135
@ViewChild('inputGroupPrefix', { read: ElementRef, static: false })
133136
protected inputGroupPrefix: ElementRef;
134137

@@ -437,15 +440,18 @@ export class IgxGridFilteringRowComponent implements AfterViewInit {
437440
* Event handler for focusout on the input group.
438441
*/
439442
public onInputGroupFocusout() {
440-
if (!this.value && this.value !== 0 && !this.expression.condition.isUnary) {
443+
if (!this.value && this.value !== 0 &&
444+
this.expression.condition && !this.expression.condition.isUnary) {
441445
return;
442446
}
443447
requestAnimationFrame(() => {
444448
const focusedElement = document.activeElement;
445449
if (focusedElement.className === 'igx-chip__remove') {
446450
return;
447451
}
448-
if (!(focusedElement && this.inputGroup.nativeElement.contains(focusedElement))
452+
if (!(focusedElement &&
453+
(this.inputGroup !== undefined ? this.inputGroup.nativeElement.contains(focusedElement) :
454+
this.inputGroupDate.nativeElement.contains(focusedElement)))
449455
&& this.dropDownConditions.collapsed) {
450456
this.commitInput();
451457
}
@@ -534,7 +540,9 @@ export class IgxGridFilteringRowComponent implements AfterViewInit {
534540

535541
public onChipPointerdown(args, chip: IgxChipComponent) {
536542
const activeElement = document.activeElement;
537-
this._cancelChipClick = chip.selected && activeElement && this.inputGroup.nativeElement.contains(activeElement);
543+
this._cancelChipClick = chip.selected && activeElement &&
544+
(this.inputGroup !== undefined ? this.inputGroup.nativeElement.contains(activeElement) :
545+
this.inputGroupDate.nativeElement.contains(activeElement));
538546
}
539547

540548
public onChipClick(args, item: ExpressionUI) {

0 commit comments

Comments
 (0)