Skip to content

Commit d2ca291

Browse files
committed
chore(*): revert get row from grid collection
1 parent 60ecf9a commit d2ca291

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

projects/igniteui-angular/src/lib/grids/grid/grid.component.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1030,7 +1030,7 @@ export class IgxGridComponent extends IgxGridBaseDirective implements GridType,
10301030
*/
10311031
public getRowByIndex(index: number): RowType {
10321032
if (this.gridAPI.grid.virtualizationState){
1033-
return this.createRow(index);
1033+
index = index - this.gridAPI.grid.virtualizationState.startIndex;
10341034
}
10351035
if (index < 0 || index >= this.dataView.length) {
10361036
return undefined;
@@ -1104,6 +1104,9 @@ export class IgxGridComponent extends IgxGridBaseDirective implements GridType,
11041104
const row = this.getRowByIndex(rowIndex);
11051105
const column = this.columnList.find((col) => col.field === columnField);
11061106
if (row && row instanceof IgxGridRow && !row.data?.detailsData && column) {
1107+
if (this.gridAPI.grid.virtualizationState){
1108+
rowIndex = row.index;
1109+
}
11071110
return new IgxGridCell(this, rowIndex, columnField);
11081111
}
11091112
}
@@ -1143,13 +1146,8 @@ export class IgxGridComponent extends IgxGridBaseDirective implements GridType,
11431146
*/
11441147
public createRow(index: number, data?: any): RowType {
11451148
let row: RowType;
1146-
let rec: any;
1147-
if (this.virtualizationState){
1148-
rec = data ?? this.gridAPI.get_row_by_index(index).rowData;
1149-
}else {
1150-
rec = data ?? this.dataView[index];
1151-
}
11521149

1150+
const rec: any = data ?? this.dataView[index];
11531151

11541152
if (rec && this.isGroupByRecord(rec)) {
11551153
row = new IgxGroupByRow(this, index, rec);

0 commit comments

Comments
 (0)