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

Treeview Issues

0 Answers 99 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Richard
Top achievements
Rank 1
Richard asked on 26 Jan 2012, 05:15 PM
I am using an ajax call to get my initial nodes by doing this:
$(result.d).each(function () {
    $("#treeData").append("<li data-id='" + this.GroupId + "'>" + this.Name + "</li>");
});
 
treeview = $("#treeData").kendoTreeView({
     select: onKendoNodeSelect
});

This sets the nodes up ok but when a node is selected I tested with these two lines:
alert($(e.node).data("id"));
alert($(e.node).text());

The first is null but the second displays the correct text for the selected node, why is the first one null?

Also I tried to append to the node like so:
var selectedNode = treeview.select();
treeview.append({ text: "new node" }, selectedNode);

And it didn't display until I clicked on something else? I'm also not sure how to apply data attributes when appending?

No answers yet. Maybe you can help?

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