From 636cfa9123d8766791b7164872d2cc1e2d92b2a1 Mon Sep 17 00:00:00 2001 From: Stefan Stoyanov Date: Thu, 8 Nov 2018 10:50:21 +0200 Subject: [PATCH] fix(igx-grid): Get scroll from first row, when there is one, #2951 --- .../src/lib/grids/grid-navigation.service.ts | 23 +++++++++++++------ 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/projects/igniteui-angular/src/lib/grids/grid-navigation.service.ts b/projects/igniteui-angular/src/lib/grids/grid-navigation.service.ts index 33e9ee9f929..06ce71b72be 100644 --- a/projects/igniteui-angular/src/lib/grids/grid-navigation.service.ts +++ b/projects/igniteui-angular/src/lib/grids/grid-navigation.service.ts @@ -36,26 +36,35 @@ export class IgxGridNavigationService { } public isColumnFullyVisible(visibleColumnIndex: number) { - const horizontalScroll = this.grid.headerContainer.getHorizontalScroll(); + let forOfDir; + if (this.grid.dataRowList.length > 0) { + forOfDir = this.grid.dataRowList.first.virtDirRow; + } else { + forOfDir = this.grid.headerContainer; + } + const horizontalScroll = forOfDir.getHorizontalScroll(); if (!horizontalScroll.clientWidth || this.grid.columnList.filter(c => !c.columnGroup).find((column) => column.visibleIndex === visibleColumnIndex).pinned) { return true; } const index = this.getColumnUnpinnedIndex(visibleColumnIndex); - return this.displayContainerWidth >= - this.grid.headerContainer.getColumnScrollLeft(index + 1) - - this.displayContainerScrollLeft; + return this.displayContainerWidth >= forOfDir.getColumnScrollLeft(index + 1) - this.displayContainerScrollLeft; } public isColumnLeftFullyVisible(visibleColumnIndex) { - const horizontalScroll = this.grid.headerContainer.getHorizontalScroll(); + let forOfDir; + if (this.grid.dataRowList.length > 0) { + forOfDir = this.grid.dataRowList.first.virtDirRow; + } else { + forOfDir = this.grid.headerContainer; + } + const horizontalScroll = forOfDir.getHorizontalScroll(); if (!horizontalScroll.clientWidth || this.grid.columnList.filter(c => !c.columnGroup).find((column) => column.visibleIndex === visibleColumnIndex).pinned) { return true; } const index = this.getColumnUnpinnedIndex(visibleColumnIndex); - return this.displayContainerScrollLeft <= - this.grid.headerContainer.getColumnScrollLeft(index); + return this.displayContainerScrollLeft <= forOfDir.getColumnScrollLeft(index); } public get gridOrderedColumns(): IgxColumnComponent[] {