Skip to content

Commit 23f597e

Browse files
authored
Merge pull request #16716 from IgniteUI/skrastev/fix-16713-master
fix(treeGrid): Fix expansion state returning 0 instead of false in some cases.
2 parents f8ef6ab + f1241be commit 23f597e

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ export class IgxTreeGridAPIService extends GridBaseAPIService<GridType> {
8383
if (expanded !== undefined) {
8484
return expanded;
8585
} else {
86-
return record.children && record.children.length && record.level < grid.expansionDepth;
86+
return record.children && !!record.children.length && record.level < grid.expansionDepth;
8787
}
8888
}
8989

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

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

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

0 commit comments

Comments
 (0)