Hi
I have rendered the grid with columns defined by an array of objects using ng-for:
<ejs-treegrid #treegrid [dataSource]='data' childMapping='subtasks' [treeColumnIndex]='1' height='310' [frozenColumns]='frozenColumns' [allowSelection]='false'>
<e-columns>
<e-column [field]='item.field' [headerText]='item.headerText' width='120' textAlign='Right' *ngFor="let item of columns"></e-column>
</e-columns>
</ejs-treegrid>
I will dynamically set or change columns by:
this.columns = [
{ field: 'taskID', headerText: 'taskID' },
{ field: 'taskName', headerText: 'taskName' },
{ field: 'duration', headerText: 'duration' },
{ field: 'progress', headerText: 'progress' },
{ field: 'priority', headerText: 'priority' },
];
Then i got errors when I set frozenColumns = 2.
u can see sample here:
https://stackblitz.com/edit/angular-zyv9nj?file=app.component.ts
Could u help me to solve this problem?
Thx
Regards
Hi Pon selva,
Thank you for the reply. Looking forward to getting your further details.
Regards.
|
Your code:
handleChangeColumns() {
this.columns = [
{ field: 'taskID', headerText: 'taskID' },
{ field: 'taskName', headerText: 'taskName' },
{ field: 'duration', headerText: 'duration' },
{ field: 'progress', headerText: 'progress' },
{ field: 'priority', headerText: 'priority' },
];
// this.treegrid.refresh();
}
handleFreezeColumns() {
this.frozenColumns = 2;
}
Modified code:
handleChangeColumns() {
this.grid.columns = [
{ field: 'taskID', headerText: 'taskID' },
{ field: 'taskName', headerText: 'taskName' },
];
this.grid.refreshColumns();
}
handleFreezeColumns() {
this.grid.frozenColumns = 1;
}
|
Hi Pon selva Jeganathan,
Thx for your help.
It seems there are still some problems with assigning tree-grid columns property directly. But this issue can be solved by 'splice' or 'push'.
plz refer to the below sample:
https://stackblitz.com/edit/angular-zyv9nj-t9yovi?file=app.component.ts
Regards,
Jeffery