From d3172585ba0e18222ec094d35d9a5a0c6361846d Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Thu, 12 Jul 2018 12:35:12 -0400 Subject: [PATCH] LP#1775466 Grid pageOffset option continued Signed-off-by: Bill Erickson --- Open-ILS/src/eg2/src/app/share/grid/grid.ts | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/Open-ILS/src/eg2/src/app/share/grid/grid.ts b/Open-ILS/src/eg2/src/app/share/grid/grid.ts index b3e373e756..45d25252ad 100644 --- a/Open-ILS/src/eg2/src/app/share/grid/grid.ts +++ b/Open-ILS/src/eg2/src/app/share/grid/grid.ts @@ -432,21 +432,24 @@ export class GridContext { return this.getRowColumnValue(row, col); } - // Returns the array position of the row-by-index in the - // dataSource array. + // Returns position in the data source array of the row with + // the provided index. getRowPosition(index: any): number { // for-loop for early exit for (let idx = 0; idx < this.dataSource.data.length; idx++) { - if (index === this.getRowIndex(this.dataSource.data[idx])) { + const row = this.dataSource.data[idx]; + if (row !== undefined && index === this.getRowIndex(row)) { return idx; } } } + // Return the row with the provided index. getRowByIndex(index: any): any { for (let idx = 0; idx < this.dataSource.data.length; idx++) { - if (index === this.getRowIndex(this.dataSource.data[idx])) { - return this.dataSource.data[idx]; + const row = this.dataSource.data[idx]; + if (row !== undefined && index === this.getRowIndex(row)) { + return row; } } } -- 2.11.0