Skip to content

Commit 4b09361

Browse files
committed
fix(Grid): should not throw an error when remove group column #7337
1 parent 5714b29 commit 4b09361

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

projects/igniteui-angular/src/lib/grids/grid-base.directive.ts

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import {
99
ElementRef,
1010
EventEmitter,
1111
HostBinding,
12-
HostListener,
1312
Inject,
1413
Input,
1514
IterableChangeRecord,
@@ -32,7 +31,7 @@ import {
3231
} from '@angular/core';
3332
import ResizeObserver from 'resize-observer-polyfill';
3433
import 'igniteui-trial-watermark';
35-
import { Subject, pipe } from 'rxjs';
34+
import { Subject, pipe, fromEvent } from 'rxjs';
3635
import { takeUntil, first, filter, throttleTime, map } from 'rxjs/operators';
3736
import { cloneArray, flatten, mergeObjects, isIE, compareMaps } from '../core/utils';
3837
import { DataType } from '../data-operations/data-util';
@@ -2815,15 +2814,6 @@ export class IgxGridBaseDirective extends DisplayDensityBase implements
28152814
return this._pinnedRecordIDs.length;
28162815
}
28172816

2818-
@HostListener('focusout', ['$event'])
2819-
public blur(event) {
2820-
if (!this.crudService.cell && (event.target === this.tbody.nativeElement &&
2821-
this.navigation.activeNode.row >= 0 && this.navigation.activeNode.row < this.dataView.length)
2822-
|| (event.target === this.theadRow.nativeElement && this.navigation.activeNode.row === -1)
2823-
|| (event.target === this.tfoot.nativeElement && this.navigation.activeNode.row === this.dataView.length)) {
2824-
this.navigation.activeNode = {} as IActiveNode;
2825-
}
2826-
}
28272817

28282818
constructor(
28292819
public selectionService: IgxGridSelectionService,
@@ -2858,6 +2848,14 @@ export class IgxGridBaseDirective extends DisplayDensityBase implements
28582848

28592849
_setupListeners() {
28602850
const destructor = takeUntil<any>(this.destroy$);
2851+
fromEvent(this.nativeElement, 'focusout').pipe(filter(() => !!this.navigation.activeNode), destructor).subscribe((event) => {
2852+
if (!this.crudService.cell && !!this.navigation.activeNode && (event.target === this.tbody.nativeElement &&
2853+
this.navigation.activeNode.row >= 0 && this.navigation.activeNode.row < this.dataView.length)
2854+
|| (event.target === this.theadRow.nativeElement && this.navigation.activeNode.row === -1)
2855+
|| (event.target === this.tfoot.nativeElement && this.navigation.activeNode.row === this.dataView.length)) {
2856+
this.navigation.activeNode = {} as IActiveNode;
2857+
}
2858+
});
28612859
this.onRowAdded.pipe(destructor).subscribe(args => this.refreshGridState(args));
28622860
this.onRowDeleted.pipe(destructor).subscribe(args => {
28632861
this.summaryService.deleteOperation = true;

0 commit comments

Comments
 (0)