How to display multiple tree/expander columns in TreeGrid
In the TreeGrid control, there is built-in support to display only one tree column. And the position of the tree column can be changed using the treeColumnIndex property. By default, the value of this property is set to 0.
But, it is possible to display two/more tree columns with the tree column behavior by using column template support.
The below code example explains about displaying custom tree column in TreeGrid using column template.
<div id="TreeGridContainer" style="height:350px;width:100%;"></div> <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> <script type="text/javascript"> $("#TreeGridContainer").ejTreeGrid({ //... treeColumnIndex: 1, columns: [ {field: "taskID", headerText: "Task Id", width: 55}, {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"}, ]
A sample to display two tree columns in TreeGrid is available in the following link,