Edit this page

append

Appends a node to any level of the TreeView . This method may also be used to reorder nodes.

Example

<div id="treeview"></div>
<script>
$("#treeview").kendoTreeView({
  dataSource: [
    { text: "foo" }
  ]
});

var treeview = $("#treeview").data("kendoTreeView");
// appends a new node to the root level
treeview.append({ text: "bar" });

// appends a new node to the first treeview item
treeview.append({ text: "baz" }, $("#treeview .k-item:first"));

// move the item with text "bar" within the item with text "foo"
treeview.append(treeview.findByText("bar"), treeview.findByText("foo"));

// append two items to the root level
treeview.append([
  { text: "qux" },
  { text: "cat" }
]);
</script>

Parameters

nodeData Object |jQuery

A JSON-formatted string or selector that specifies the node to be appended. If the argument is a plain JavaScript object, a new item will be created. If the argument is a jQuery element that holds a node, the TreeView node will be moved. If the argument is an array of objects, each item of the array will be appended.

parentNode jQuery (optional)

The node that will contain the newly appended node. If not specified, the new node will be appended to the root group of the TreeView.

success Function (optional)

A success callback that will be called once the new node has been appended. Useful in the case of remote binding where an item is appended to an unfetched node. The callback is called once the siblings have been fetched.

Returns

jQuery The inserted <li> element, wrapped in a jQuery object, or null if the new model has not been inserted immediately.

Is this article helpful? Yes / No
Thank you for your feedback!

Give article feedback

Tell us how we can improve this article

close
Dummy