Skip to content

Commit 53a4f7b

Browse files
authored
Merge pull request #7194 from IgniteUI/mkirova/fix-pin-issue-treegrid
fix(igxTreeGrid): Overwrite setter as well as the getter.
2 parents 4aa5951 + c051787 commit 53a4f7b

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1405,6 +1405,15 @@ describe('IgxTreeGrid - Integration #tGrid', () => {
14051405
treeGrid.getRowByKey(711).unpin();
14061406
fix.detectChanges();
14071407
expect(treeGrid.pinnedRecordsCount).toBe(0);
1408+
1409+
1410+
treeGrid.getRowByKey(711).pinned = true;
1411+
fix.detectChanges();
1412+
expect(treeGrid.pinnedRecordsCount).toBe(1);
1413+
1414+
treeGrid.getRowByKey(711).pinned = false;
1415+
fix.detectChanges();
1416+
expect(treeGrid.pinnedRecordsCount).toBe(0);
14081417
});
14091418

14101419
it('should pin/unpin a row at the bottom', () => {

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

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,31 @@ export class IgxTreeGridRowComponent extends IgxRowDirective<IgxTreeGridComponen
3636
}
3737
}
3838

39+
/**
40+
* Gets whether the row is pinned.
41+
* ```typescript
42+
* let isPinned = row.pinned;
43+
* ```
44+
*/
3945
public get pinned() {
4046
return this.grid.isRecordPinned(this._treeRow);
4147
}
4248

49+
/**
50+
* Sets whether the row is pinned.
51+
* Default value is `false`.
52+
* ```typescript
53+
* this.grid.selectedRows[0].pinned = true;
54+
* ```
55+
*/
56+
public set pinned(value: boolean) {
57+
if (value) {
58+
this.grid.pinRow(this.rowID);
59+
} else {
60+
this.grid.unpinRow(this.rowID);
61+
}
62+
}
63+
4364
/**
4465
* Returns a value indicating whether the row component is expanded.
4566
*

0 commit comments

Comments
 (0)