Skip to content

Commit 5e6245f

Browse files
authored
Merge pull request #8313 from IgniteUI/mkirova/fix-8308
fix(igxGrid): If add row is not fully in view, scroll it in view.
2 parents 1c8548e + 2c81e4f commit 5e6245f

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4096,7 +4096,13 @@ export abstract class IgxGridBaseDirective extends DisplayDensityBase implements
40964096
};
40974097
this.verticalScrollContainer.onDataChanged.pipe(first()).subscribe(() => {
40984098
this.cdr.detectChanges();
4099-
const row = this.getRowByIndex(this.addRowParent.index + 1);
4099+
const newRowIndex = this.addRowParent.index + 1;
4100+
// ensure adding row is in view.
4101+
const shouldScroll = this.navigation.shouldPerformVerticalScroll(newRowIndex, -1);
4102+
if (shouldScroll) {
4103+
this.navigateTo(newRowIndex, -1);
4104+
}
4105+
const row = this.getRowByIndex(newRowIndex);
41004106
const cell = row.cells.find(c => c.editable);
41014107
cell.setEditMode(true);
41024108
cell.activate();

0 commit comments

Comments
 (0)