We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Question treeColumnIndex

Hi,

I wonder if it is possible to define more than one column for the treeColumnIndex property? Example, I would like to set it to column 1 and 2.
By google translator

Thanks,
Regards,
Daniela

3 Replies

JD Jayakumar Duraisamy Syncfusion Team July 26, 2017 11:16 AM UTC

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 



DM Daniela Menezes Tunes July 26, 2017 07:43 PM UTC

Hi,

Worked! Thanks for your help!

Regards,
Daniela.



JD Jayakumar Duraisamy Syncfusion Team July 27, 2017 04:15 AM UTC

Hi Daniela, 
We are glad that your requirement has been met. Please let us know if you need any other assistance. 
Regards, 
Jayakumar D 


Loader.
Live Chat Icon For mobile
Up arrow icon