Skip to content

Commit 15054ce

Browse files
committed
fix(treeGrid): Fix expansion state returning 0 instead of false in some cases.
1 parent 186b470 commit 15054ce

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ export class IgxTreeGridAPIService extends GridBaseAPIService<GridType> {
7676
if (expanded !== undefined) {
7777
return expanded;
7878
} else {
79-
return record.children && record.children.length && record.level < grid.expansionDepth;
79+
return record.children && !!record.children.length && record.level < grid.expansionDepth;
8080
}
8181
}
8282

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,15 @@ describe('IgxTreeGrid - Expanding / Collapsing #tGrid', () => {
4545
treeGrid = fix.componentInstance.treeGrid;
4646
});
4747

48+
it('should return boolean for expand state of row without children using getRowByKey()', () => {
49+
treeGrid.primaryKey = "ID";
50+
treeGrid.childDataKey = "";
51+
fix.detectChanges();
52+
53+
const testRow = treeGrid.getRowByKey(147);
54+
expect(testRow.expanded).toEqual(false);
55+
});
56+
4857
it('check row expanding and collapsing are changing rows count (UI)', () => {
4958
let rows = TreeGridFunctions.getAllRows(fix);
5059
expect(rows.length).toBe(4);

0 commit comments

Comments
 (0)