@@ -1030,7 +1030,7 @@ export class IgxGridComponent extends IgxGridBaseDirective implements GridType,
1030
1030
*/
1031
1031
public getRowByIndex ( index : number ) : RowType {
1032
1032
if ( this . gridAPI . grid . virtualizationState ) {
1033
- index = index - this . gridAPI . grid . virtualizationState . startIndex ;
1033
+ return this . createRow ( index ) ;
1034
1034
}
1035
1035
if ( index < 0 || index >= this . dataView . length ) {
1036
1036
return undefined ;
@@ -1104,9 +1104,6 @@ export class IgxGridComponent extends IgxGridBaseDirective implements GridType,
1104
1104
const row = this . getRowByIndex ( rowIndex ) ;
1105
1105
const column = this . columnList . find ( ( col ) => col . field === columnField ) ;
1106
1106
if ( row && row instanceof IgxGridRow && ! row . data ?. detailsData && column ) {
1107
- if ( this . gridAPI . grid . virtualizationState ) {
1108
- rowIndex = row . index ;
1109
- }
1110
1107
return new IgxGridCell ( this , rowIndex , columnField ) ;
1111
1108
}
1112
1109
}
@@ -1146,8 +1143,14 @@ export class IgxGridComponent extends IgxGridBaseDirective implements GridType,
1146
1143
*/
1147
1144
public createRow ( index : number , data ?: any ) : RowType {
1148
1145
let row : RowType ;
1146
+ let rec : any ;
1149
1147
1150
- const rec : any = data ?? this . dataView [ index ] ;
1148
+ if ( this . gridAPI . grid . virtualizationState ) {
1149
+ const virtIndex = index - this . gridAPI . grid . virtualizationState . startIndex ;
1150
+ rec = data ?? this . dataView [ virtIndex ] ;
1151
+ } else {
1152
+ rec = data ?? this . dataView [ index ] ;
1153
+ }
1151
1154
1152
1155
if ( rec && this . isGroupByRecord ( rec ) ) {
1153
1156
row = new IgxGroupByRow ( this , index , rec ) ;
0 commit comments