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

Performance Question

1 Answer 119 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Mike
Top achievements
Rank 1
Mike asked on 09 Mar 2012, 10:51 PM
Hello.  I'm looking for performance optimizations in my web application which uses kendoUI.  Which of these approaches would you expect to be faster?

Approach 1:
Build a large DOM tree full of <ul> and <.li> elements, representing a kendo treeview.  When all DOM elements are constructed, call .kendoTreeView(); so that each set of DOM elements is converted to a treeview.

Approach 2:
Build a large JSON structure representing kendo treeview data.  Initialize the kendotreeview in the page by calling .kendoTreeView() and then insert the data into the tree by calling the append function

Or is there another even better way than either of these approaches?

1 Answer, 1 is accepted

Sort by
0
Accepted
Alex Gyoshev
Telerik team
answered on 12 Mar 2012, 08:47 AM
Hello Mike,

Initializing the treeview directly from JSON is faster, as it does not need to parse the DOM tree (which, as every DOM operation, is slow):

$("#tree").kendoTreeView({
    dataSource: [
        { text: "foo" }
    ]
});


 Using append() to add the items is as fast as initializing the treeview from JSON.

Greetings,
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!
Tags
TreeView
Asked by
Mike
Top achievements
Rank 1
Answers by
Alex Gyoshev
Telerik team
Share this question
or