In TreeList, how to retain the sort order of child rows and sort only the parent rows?

2 posts, 0 answers
  1. Nayana
    Nayana avatar
    3 posts
    Member since:
    Sep 2015

    Posted 10 Jan Link to this post


     I have a requirement where i need to sort only the parent rows in the treeList, while the child rows retain the default ascending order. 

    1. Is there a way i can use compare method to retain sort order of child rows?

    2. I also have to sort the parent rows for all pages in the treeList. I have implemented pagination using the method mentioned in this thread. How can sorting on entire data set be achieved? 

    I have used the sort hack mentioned in the thread:

    // sort hack!
    var originalSortFn =; = function (e) {
        if (arguments.length > 0) {
        return originalSortFn.apply(this, arguments);

     But, this hack code sorts the content in the displayed page first, then takes the entire data set. As a result, we see the data getting bound twice to the treeList, first time with the sort data of current page and then with the sorted data for entire data set. How can this be avoided? I want the data to be bound only once, after the sorting of entire data set?

     I don't have a working jsfiddle example for this problem.


    Thanks in advance.

  2. Nikolay Rusev
    Nikolay Rusev avatar
    2275 posts

    Posted 13 Jan Link to this post

    Hello Nayana,


    To your questions:

     1. No, the widget doesn't have such functionality. It will sort all levels. In the matter of fact the levels are only UI representation of the hierarchy in the TreeListDatSource all data is flat.


     2. Paging for the widget is also not supported. The thread which you refer to explains why we do not support paging. The sample implementation is a custom one and not supported by us. It might be applicable for some cases, but the widget is not intended to work this way.


    Nikolay Rusev
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top