I am using an ajax call to get my initial nodes by doing this:
This sets the nodes up ok but when a node is selected I tested with these two lines:
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:
And it didn't display until I clicked on something else? I'm also not sure how to apply data attributes when appending?
$(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?