From 571cd07463b2c087315a2855ba7a0dad0ef3425c Mon Sep 17 00:00:00 2001 From: ddincheva Date: Mon, 12 Nov 2018 17:05:23 +0200 Subject: [PATCH 1/2] fix(IgxTreeGrid): refocus row when expand/collapse tree row #2935 --- .../src/lib/grids/tree-grid/tree-grid-api.service.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/igniteui-angular/src/lib/grids/tree-grid/tree-grid-api.service.ts b/projects/igniteui-angular/src/lib/grids/tree-grid/tree-grid-api.service.ts index 85114348e66..d7c56066018 100644 --- a/projects/igniteui-angular/src/lib/grids/tree-grid/tree-grid-api.service.ts +++ b/projects/igniteui-angular/src/lib/grids/tree-grid/tree-grid-api.service.ts @@ -76,6 +76,7 @@ export class IgxTreeGridAPIService extends GridBaseAPIService { @@ -83,7 +84,7 @@ export class IgxTreeGridAPIService extends GridBaseAPIService Date: Mon, 12 Nov 2018 17:06:47 +0200 Subject: [PATCH 2/2] fix(IgxGrid): shound not toggle expand on arrowLeft when row is expanded #2950 --- .../lib/grids/grid/groupby-row.component.ts | 34 +++++++++---------- 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/projects/igniteui-angular/src/lib/grids/grid/groupby-row.component.ts b/projects/igniteui-angular/src/lib/grids/grid/groupby-row.component.ts index b3e90c922be..0e3cbae41f0 100644 --- a/projects/igniteui-angular/src/lib/grids/grid/groupby-row.component.ts +++ b/projects/igniteui-angular/src/lib/grids/grid/groupby-row.component.ts @@ -163,11 +163,17 @@ export class IgxGridGroupByRowComponent { * this.grid1.rowList.first.toggle() * ``` */ - public toggle(key?) { - const shouldExpand = (!key && !this.expanded) || (key && !this.expanded && (key === 'arrowleft' || key === 'left')); - this.handleToggleScroll(); - if (!shouldExpand) { - this.grid.verticalScrollContainer.getVerticalScroll().dispatchEvent(new Event('scroll')); + public toggle() { + const isVirtualized = !this.grid.verticalScrollContainer.dc.instance.notVirtual; + const groupRowIndex = this.index; + this.grid.toggleGroup(this.groupRow); + if (isVirtualized) { + this.grid.verticalScrollContainer.onChunkLoad + .pipe(first()) + .subscribe(() => { + const groupRow = this.grid.nativeElement.querySelector(`[data-rowIndex="${groupRowIndex}"]`); + if (groupRow) { groupRow.focus(); } + }); } } @@ -185,7 +191,10 @@ export class IgxGridGroupByRowComponent { if (this.isToggleKey(key)) { if (!alt) { return; } - this.toggle(key); + if ((this.expanded && (key === 'left' || key === 'arrowleft')) || + (!this.expanded && (key === 'right' || key === 'arrowright'))) { + this.toggle(); + } return; } const args = { cell: null, groupRow: this, event: event, cancel: false }; @@ -252,16 +261,5 @@ export class IgxGridGroupByRowComponent { private isToggleKey(key) { return ['left', 'right', 'arrowleft', 'arrowright'].indexOf(key) !== -1; } - private handleToggleScroll() { - if (this.grid.rowList.length > 0 && this.grid.rowList.last.index === - this.grid.verticalScrollContainer.igxForOf.length - 1) { - const groupRowIndex = this.index; - this.grid.verticalScrollContainer.onChunkLoad - .pipe(first()) - .subscribe(() => { - this.grid.nativeElement.querySelector(`[data-rowIndex="${groupRowIndex}"]`).focus(); - }); - } - this.grid.toggleGroup(this.groupRow); - } + }