Skip to content

Commit

Permalink
fix(grid): fix getCellByColumn with virtualization #10172 -master
Browse files Browse the repository at this point in the history
  • Loading branch information
dobromirts committed Oct 1, 2021
1 parent 2709c3d commit 31c29dc
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1029,6 +1029,9 @@ export class IgxGridComponent extends IgxGridBaseDirective implements GridType,
* @param index
*/
public getRowByIndex(index: number): RowType {
if (this.gridAPI.grid.virtualizationState){
index = index - this.gridAPI.grid.virtualizationState.startIndex;
}
if (index < 0 || index >= this.dataView.length) {
return undefined;
}
Expand Down Expand Up @@ -1101,6 +1104,9 @@ export class IgxGridComponent extends IgxGridBaseDirective implements GridType,
const row = this.getRowByIndex(rowIndex);
const column = this.columnList.find((col) => col.field === columnField);
if (row && row instanceof IgxGridRow && !row.data?.detailsData && column) {
if (this.gridAPI.grid.virtualizationState){
rowIndex = row.index;
}
return new IgxGridCell(this, rowIndex, columnField);
}
}
Expand Down

0 comments on commit 31c29dc

Please sign in to comment.