Skip to content

Commit 60ecf9a

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

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

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

Lines changed: 7 additions & 5 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-
index = index - this.gridAPI.grid.virtualizationState.startIndex;
1033+
return this.createRow(index);
10341034
}
10351035
if (index < 0 || index >= this.dataView.length) {
10361036
return undefined;
@@ -1104,9 +1104,6 @@ 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-
}
11101107
return new IgxGridCell(this, rowIndex, columnField);
11111108
}
11121109
}
@@ -1146,8 +1143,13 @@ export class IgxGridComponent extends IgxGridBaseDirective implements GridType,
11461143
*/
11471144
public createRow(index: number, data?: any): RowType {
11481145
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+
}
11491152

1150-
const rec: any = data ?? this.dataView[index];
11511153

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

0 commit comments

Comments
 (0)