Insert Node INTO / As a child of an existing node

2 posts, 0 answers
  1. Coty
    Coty avatar
    41 posts
    Member since:
    Jun 2014

    Posted 18 Feb 2015 Link to this post

    hi there,  I have a kendo treeview.

    This treeview has 2 levels, parent nodes and children nodes.  Some top level nodes don't have children.  A user can add or remove nodes at any level.  To add a top level node I use append.  To add a child node I use insertAfter.  What I haven't figured out is how to add a node as a child to a top level node that previously had no children before it.  Essentially I need to know how to add the First Child to an existing node.

    Thanks,

    Coty
  2. Coty
    Coty avatar
    41 posts
    Member since:
    Jun 2014

    Posted 18 Feb 2015 in reply to Coty Link to this post

    Ah I found the answer in the documentation, I must have missed it the first 5 times I went through it!

    treeview.append({
        Id: data,
        Order: order,
        Name: name,
        HasNotes: false,
        HasAttachments: false,
        template: kendo.template($("#treeview-template").html())
    }, ParentNode);

    You just pass the parent node into the append function...



  3. Kendo UI is VS 2017 Ready
Back to Top