Sorting for a TreeView

2 posts, 0 answers
  1. James
    James avatar
    8 posts
    Member since:
    Nov 2011

    Posted 18 Apr 2012 Link to this post

    Hi,
    I am dynamically building a ul and then applying a kendoTreeView() on it everything is working prefectly fine but I am struggling to sore the tree as there is no method provided and I can't apply any logic as i am building very complicated ul.
    My code as below:
    function BuildTree() {
        $(xmlDoc.getElementsByTagName("Item")).each(function () {
     
            var thisItem = $(this);
            var list = " "; var list1 = " ";
            $(parentIDFields).each(function (index, item) {
     
                if (thisItem.attr(item) != null && thisItem.attr(descriptionCol) != null) {
                    if (index == 0) {
                        list += "<li id=" + thisItem.attr("ID") + " onclick=sendHTML(" + thisItem.attr("ID") + ");>" + thisItem.attr(item);
                        list1 += "</li>";
                    }
                    else {
                        list += "<ul><li id=" + thisItem.attr("ID") + " onclick=sendHTML(" + thisItem.attr("ID") + ");>" + thisItem.attr(item);
                        list1 += "</li></ul>";
                    }
                }
            });       
            $("#treeView").append(list + "<ul><li id=" + thisItem.attr("ID") + ">" + thisItem.attr(descriptionCol) + " </li></ul>" + list1);
        });
     
        $(document).ready(function () {
            $("#treeView").kendoTreeView();
        });
     
    }

    can you please show any pointers towards solution.
  2. Alex Gyoshev
    Admin
    Alex Gyoshev avatar
    2527 posts

    Posted 18 Apr 2012 Link to this post

    Hello James,

    This functionality is currently unsupported. You need to sort the data before initializing the treeview.

    You can submit a feature request for that on uservoice.

    All the best,
    Alex Gyoshev
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top