Hi Daniela,
In TreeGrid, we can render only one column as tree column using treeColumnIndex property, but the requirement for rendering more than one column as tree columns in TreeGrid can be achieved using column template support. It is possible to render many custom columns like tree column with same behavior.
Please refer following code snippet,
$("#TreeGridContainer").ejTreeGrid({
treeColumnIndex: 1,
//…
columns: [
{ field: "taskID", headerText: "Task Id" },
{field: "taskName", headerText: "Task Name" },
{ field: "startDate", headerText: "Start Date", editType: "datepicker", format: "{0:M/dd/yyyy}" },
{ field: "endDate", headerText: "End Date", editType: "datepicker", format: "{0:M/dd/yyyy}" },
{ field: "priority", headerText: "Priority", isTemplateColumn: true, templateID: "customColumnTemplate" },
{ field: "progress", headerText: "Progress", editType: "numericedit"},
] |
[template]
<script type="text/x-jsrender" id="customColumnTemplate">
<div style='height:20px;' unselectable='on'>
{{if hasChildRecords}}<div class='intend' style='height:1px; float:left; width:{{:level*20}}px; display:inline-block;'></div>
{{else !hasChildRecords}}
<div class='intend' style='height:1px; float:left; width:{{:(level)*20}}px; display:inline-block;'></div>
{{/if}}
<div class='{{if expanded}}e-treegridexpand e-icon {{else hasChildRecords}}e-treegridcollapse e-icon {{/if}} {{if level===4}}e-doc{{/if}}' style='height:20px;width:30px;margin:auto;float:left;margin-left:10px;
style=' float left;display:inline-block; unselectable='on'></div>
<div class='e-cell' style='display:inline-block;width:100%' unselectable='on'>{{:#data['priority']}}</div>
</div>
</script> |
We have also prepared a sample for your reference. Please find the sample location link as below,
Please let us know, if you require any other assistance on this.
Regards,
Jayakumar D