Skip to content

Commit 955b442

Browse files
authored
Merge pull request #9541 from IgniteUI/mdragnev/fix-9436-12.0.x
Add a null check of filteredSortedData in getRowByKey method
2 parents 0f0d67b + c537508 commit 955b442

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -661,8 +661,8 @@ export class IgxTreeGridComponent extends IgxGridBaseDirective implements GridTy
661661
* @param index
662662
*/
663663
public getRowByKey(key: any): RowType {
664-
const rec = this.primaryKey ? this.filteredSortedData.find(r => r[this.primaryKey] === key) :
665-
this.filteredSortedData.find(r => r === key);
664+
const rec = this.filteredSortedData ? this.primaryKey ? this.filteredSortedData.find(r => r[this.primaryKey] === key) :
665+
this.filteredSortedData.find(r => r === key) : undefined;
666666
const index = this.dataView.findIndex(r => r.data && r.data === rec);
667667
if (index < 0 || index >= this.filteredSortedData.length) {
668668
return undefined;

0 commit comments

Comments
 (0)