Treeview Issues

1 posts, 0 answers
  1. Richard
    Richard avatar
    3 posts
    Member since:
    Jan 2012

    Posted 26 Jan 2012 Link to this post

    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?
Back to Top