Skip to content

Commit d308282

Browse files
authored
Merge branch 'master' into sstoychev/groupingstrategy-master
2 parents 0937032 + bb422f8 commit d308282

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

projects/igniteui-angular/src/lib/grids/grid-navigation.service.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,10 +251,16 @@ export class IgxGridNavigationService {
251251
}
252252

253253
public isDataRow(rowIndex: number, includeSummary = false) {
254+
let curRow: any;
255+
254256
if (rowIndex < 0 || rowIndex > this.grid.dataView.length - 1) {
255-
return false;
257+
curRow = this.grid.dataView[rowIndex - this.grid.virtualizationState.startIndex];
258+
if (!curRow){
259+
return false;
260+
}
261+
}else {
262+
curRow = this.grid.dataView[rowIndex];
256263
}
257-
const curRow = this.grid.dataView[rowIndex];
258264
return curRow && !this.grid.isGroupByRecord(curRow) && !this.grid.isDetailRecord(curRow)
259265
&& !curRow.childGridsData && (includeSummary || !curRow.summaries);
260266
}

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

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1053,7 +1053,7 @@ export class IgxGridComponent extends IgxGridBaseDirective implements GridType,
10531053
* @param index
10541054
*/
10551055
public getRowByIndex(index: number): RowType {
1056-
if (index < 0 || index >= this.dataView.length) {
1056+
if (index < 0) {
10571057
return undefined;
10581058
}
10591059
return this.createRow(index);
@@ -1164,8 +1164,16 @@ export class IgxGridComponent extends IgxGridBaseDirective implements GridType,
11641164
*/
11651165
public createRow(index: number, data?: any): RowType {
11661166
let row: RowType;
1167+
let rec: any;
11671168

1168-
const rec: any = data ?? this.dataView[index];
1169+
if (index < 0 || index >= this.dataView.length) {
1170+
if (index >= this.dataView.length){
1171+
const virtIndex = index - this.gridAPI.grid.virtualizationState.startIndex;
1172+
rec = data ?? this.dataView[virtIndex];
1173+
}
1174+
}else {
1175+
rec = data ?? this.dataView[index];
1176+
}
11691177

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

0 commit comments

Comments
 (0)