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

Example: Treeview load on demand - append to selected node

0 Answers 386 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Johnny
Top achievements
Rank 1
Johnny asked on 09 Jun 2012, 02:45 PM
Greetings,
After spending a great deal of time trying to get this to work, I finally found a simple solution. Call the tree.append and pass the new item and current node as a jquery object.

treeview.append({ text: "new item text" }, $(e.node))

here is a simple sample on jsfiddle... http://jsfiddle.net/jldoubleu/BSUFs/1/

Also, the sample code.
var treeview = null
$(document).ready(function() {
 
    treeview = $("#tree").kendoTreeView({
        select: onItemSelected,
        dataSource: [{text: "A"},{text: "B"},{text: "C"},{text: "D"}]
    }).data("kendoTreeView");
 
    function onItemSelected(e) {
        for (var ictr = 0; ictr < 5; ictr++) {
            treeview.append({ text: e.node.innerText + "-" + ictr}, $(e.node))
        }
    }
});

Enjoy...

No answers yet. Maybe you can help?

Tags
TreeView
Asked by
Johnny
Top achievements
Rank 1
Share this question
or