How to render column from remote in Treegrid

Hello,

I want to know is there any format to render the treegrid column based on remote data .
<e-columns>
     <e-column allowEdtiting=false allowFiltering=true field=id></e-column>
<e-columns>

Column on TreeGrid need to be render with remote  rather than static shown above and need to be dynamic on router path change.


Regards,
Wilma Hills.


1 Reply 1 reply marked as answer

PK Padmavathy Kamalanathan Syncfusion Team November 25, 2020 11:54 AM UTC

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 


Marked as answer
Loader.
Up arrow icon