Hi Wilma Hill,
Thanks for contacting Syncfusion Forums.
Query: Column on TreeGrid need to be render with remote rather than static shown above and need to be dynamic
In Tree Grid if we do not define the columns property, the columns will be auto generated based on binded data source for all the field values in the data source by default. If you need to render only specific columns from your remote data, then you can set (also add or remove) columns to the columns property dynamically as shown in the below code,
|
[app.component.html]
<ejs-treegrid
[dataSource]="data"
allowPaging="true"
allowFiltering="true"
height="350"
idMapping="TaskID"
parentIdMapping="parentID"
[treeColumnIndex]="1"
[columns]="treeGridColumns"
[editSettings]="editSettings"
[toolbar]="toolbar"
>
</ejs-treegrid>
[app.component.ts]
export class AppComponent {
---------
treeGridColumns: any[] = [
{
field: "TaskID",
headerText: "Task ID",
allowFiltering: false,
allowEditing: true,
textAlign: "right",
isPrimaryKey: true
},
{
field: "TaskName",
headerText: "Task Name",
format: "",
allowFiltering: true,
allowEditing: true,
textAlign: "right"
},
{
field: "Progress",
headerText: "Progress",
allowFiltering: false,
allowEditing: true,
textAlign: "right"
}
];
}
|
Based on your remote data, you can change the “treeGridColumns” array and add/remove columns dynamically to Tree Grid.
Kindly get back to us for further assistance.
Regards,
Padmavathy Kamalanathan