Skip to content

Commit a60086f

Browse files
Fix error when deleting a pinned row (#12311)
* fix(tree-grid): fix error when deleting a pinned row * refactor(tree-grid): add missing semicolon * fix(tree-grid): add requested changes
1 parent db262d5 commit a60086f

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1762,5 +1762,20 @@ describe('IgxTreeGrid - Integration #tGrid', () => {
17621762
firstRow.pinned = true;
17631763
expect(firstRow.pinned).toBeTrue();
17641764
});
1765+
1766+
it('should delete pinned row without errors', () => {
1767+
treeGrid.pinRow(147);
1768+
fix.detectChanges();
1769+
const firstRow = treeGrid.pinnedRows[0];
1770+
1771+
expect(firstRow.isRoot).toBe(true);
1772+
expect(firstRow.pinned).toBeTrue();
1773+
expect(firstRow.data.ID).toEqual(147);
1774+
1775+
treeGrid.deleteRowById(147);
1776+
fix.detectChanges();
1777+
1778+
expect(firstRow.isRoot).toBe(false);
1779+
});
17651780
});
17661781
});

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ export class IgxTreeGridRowComponent extends IgxRowDirective implements DoCheck
7373
if (isPinnedArea) {
7474
treeRec = this.grid.unpinnedRecords.find(x => x.data === this.data);
7575
}
76-
return treeRec.level === 0;
76+
return treeRec?.level === 0;
7777
}
7878

7979
/**

0 commit comments

Comments
 (0)