From: Bill Erickson Date: Thu, 12 Jul 2018 16:35:12 +0000 (-0400) Subject: LP#1775466 Grid pageOffset option continued X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=35bfe0f163de6db5e40bdebd31e9cc69b20b6fcb;p=working%2FEvergreen.git LP#1775466 Grid pageOffset option continued Signed-off-by: Bill Erickson --- 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; } } }