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;
}
}
}