add(items, index, [insertAt])

Class: Tree.

Description:

Add an item or array of items to a tree node. To add item to root node use [0] for index argument.

Parameters:

Name Type Description

items

object | Array.<object>

One item object or an array of item objects.

index

Array.<number>

Index of the item to insert the passed items to. To add to the root use [0].

[insertAt]

number | undefined

Indicates at what position to inserted the items. Value -1 means the end of list.

Returns:

Returns this Tree component for method chaining.

Type: Tree