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

How is sort order handled?


I want to sort nodes by a separate integer sort order field in die database, how can it be done?

What data field is used to handle sort in the treeview object?


1 Reply

KR Karthik Ravichandran Syncfusion Team May 1, 2017 12:14 PM UTC

Hi Armand, 
Thanks for contacting Syncfusion support. 
We have checked your query (“How is sort order handled”). You can achieve your requirement by using sortSettings API in ejTreeView.  you can sort the treenodes node by its node text Please refer the below code snippet. 
    fields: { id: "id", parentId: "pid", text: "name", hasChild: "hasChild", dataSource: localData, expanded: "expanded" }, sortSettings: { 
        allowSorting: true, 
        sortOrder: ej.sortOrder.Ascending 
To achieve this with your custom field, you should map the custom field as a node Text. 
For your convenience, we have attached the sample below, 
To know more details about ejTreeView, please refer the below documentation link. 
Please let us know if you need further assistance on this. 
Karthik R 

Live Chat Icon For mobile
Up arrow icon