Skip to content

Commit 93d9b19

Browse files
committed
fix(Grid): should not throw an error when remove group column #7337
1 parent b56cc56 commit 93d9b19

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, resolveNestedPath, isObject } from '../core/utils';
3837
import { DataType } from '../data-operations/data-util';
@@ -2885,15 +2884,6 @@ export class IgxGridBaseDirective extends DisplayDensityBase implements
28852884
return this._pinnedRecordIDs.length;
28862885
}
28872886

2888-
@HostListener('focusout', ['$event'])
2889-
public blur(event) {
2890-
if (!this.crudService.cell && (event.target === this.tbody.nativeElement &&
2891-
this.navigation.activeNode.row >= 0 && this.navigation.activeNode.row < this.dataView.length)
2892-
|| (event.target === this.theadRow.nativeElement && this.navigation.activeNode.row === -1)
2893-
|| (event.target === this.tfoot.nativeElement && this.navigation.activeNode.row === this.dataView.length)) {
2894-
this.navigation.activeNode = {} as IActiveNode;
2895-
}
2896-
}
28972887

28982888
constructor(
28992889
public selectionService: IgxGridSelectionService,
@@ -2928,6 +2918,14 @@ export class IgxGridBaseDirective extends DisplayDensityBase implements
29282918

29292919
_setupListeners() {
29302920
const destructor = takeUntil<any>(this.destroy$);
2921+
fromEvent(this.nativeElement, 'focusout').pipe(filter(() => !!this.navigation.activeNode), destructor).subscribe((event) => {
2922+
if (!this.crudService.cell && !!this.navigation.activeNode && (event.target === this.tbody.nativeElement &&
2923+
this.navigation.activeNode.row >= 0 && this.navigation.activeNode.row < this.dataView.length)
2924+
|| (event.target === this.theadRow.nativeElement && this.navigation.activeNode.row === -1)
2925+
|| (event.target === this.tfoot.nativeElement && this.navigation.activeNode.row === this.dataView.length)) {
2926+
this.navigation.activeNode = {} as IActiveNode;
2927+
}
2928+
});
29312929
this.onRowAdded.pipe(destructor).subscribe(args => this.refreshGridState(args));
29322930
this.onRowDeleted.pipe(destructor).subscribe(args => {
29332931
this.summaryService.deleteOperation = true;

0 commit comments

Comments
 (0)