This is a migrated thread and some comments may be shown as answers.

Natural sort the TreeList

1 Answer 216 Views
TreeList
This is a migrated thread and some comments may be shown as answers.
Kay
Top achievements
Rank 1
Kay asked on 02 Jun 2016, 10:02 AM

How can we sort the treelist by using natural sort? Or customize the sort method?

We need the TreeList should be sorted like that:

Folder 1

     Item 5

     Item 6

     Item 50

Folder 2

     Item 3

     Item 4

     Item 30

Folder 10

     Item 1

 

 

 

 

1 Answer, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 06 Jun 2016, 08:35 AM
Hello Kelvin,

The Kendo UI TreeList is using the browser sorting algorithm, which is alphabetical.

The natural sort algorithm, can be achieved by using the widget columns.sortable.compare configuration, to add a custom logic for sorting items:

http://docs.telerik.com/kendo-ui/api/javascript/ui/treelist#configuration-columns.sortable.compare

Here you can check some examples of a custom implementation of the natural sort algorithm in Kendo UI:

http://stackoverflow.com/questions/19253583/kendo-grid-not-sorting-an-alphanumeric-column-properly-natural-sort

Let me know if you need additional information.
 
Regards,
Stefan
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
TreeList
Asked by
Kay
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Share this question
or