class anychart.data.Tree.DataItem Improve this Doc
Tree data item.
Methods Overview
Data | |
addChild() | Adds a child. |
addChildAt() | Inserts a child into a specified position. |
del() | Removes from data by specified path. |
get() | Gets a value from data by key. |
getChildAt() | Gets the child by index. |
getChildren() | Returns a copy of children array of the data item. |
getParent() | Gets a data item's parent. |
indexOfChild() | Gets the index of child in a children array. |
meta() | Metadata settings. |
numChildren() | Returns a length of children array. |
remove() | Removes data item. |
removeChild() | Removes data item's child. |
removeChildAt() | Removes child at specified position. |
removeChildren() | Removes children. |
set() | Sets a value to the data by path. |
Methods Description
addChild
Adds a child.
Params:
Name | Type | Description |
---|---|---|
child | Object | anychart.data.Tree.DataItem | Child for add. |
Returns:
anychart.data.Tree.DataItem - Self instance for method chaining.Try it:
addChildAt
Inserts a child into a specified position.
Please make sure that child has not inner cycles to avoid stack overflow exception.
Params:
Name | Type | Description |
---|---|---|
child | Object | anychart.data.Tree.DataItem | anychart.data.TreeView.DataItem | Child for add. |
index | number | Position for add child. |
Returns:
anychart.data.Tree.DataItem - Self instance for method chaining.Try it:
del
Removes from data by specified path.
Params:
Name | Type | Description |
---|---|---|
var_args | * | Path to set. |
Returns:
anychart.data.Tree.DataItem - Self instance for method chaining.Try it:
get
Gets a value from data by key.
Params:
Name | Type | Description |
---|---|---|
key | string | Key. |
Returns:
* - Value.Try it:
getChildAt
Gets the child by index.
Params:
Name | Type | Description |
---|---|---|
index | number | Index of child to find. |
Returns:
anychart.data.Tree.DataItem | undefined - Child into a specified position.Try it:
getChildren
Returns a copy of children array of the data item.
Returns:
Array.<anychart.data.Tree.DataItem> - Copy of children array.Try it:
getParent
indexOfChild
Gets the index of child in a children array.
Params:
Name | Type | Description |
---|---|---|
child | anychart.data.Tree.DataItem | anychart.data.TreeView.DataItem | Child for getting of index. |
Returns:
number - Index of child.Try it:
meta
Setter for a meta data.
Params:
Name | Type | Description |
---|---|---|
key | string | Key. |
value | * | Value to set. |
Returns:
* - Value.Try it:
numChildren
remove
Removes data item.
Detailed description
The current item is removed from parents children and becomes an orphan.
If child is a root element, it is removed from tree.
Returns:
anychart.data.Tree.DataItem - Self instance for method chaining.Try it:
removeChild
Removes data item's child.
Params:
Name | Type | Description |
---|---|---|
child | anychart.data.Tree.DataItem | Child for removal. |
Returns:
anychart.data.Tree.DataItem - Removed element or null.Try it:
removeChildAt
Removes child at specified position.
Params:
Name | Type | Description |
---|---|---|
index | number | Index of item for removal. |
Returns:
anychart.data.Tree.DataItem - Removed item or null if item is not found.Try it:
removeChildren
set
Sets a value to the data by path.
Params:
Name | Type | Description |
---|---|---|
var_args | * | Path to set. |
Returns:
anychart.data.Tree.DataItem - Self instance for method chaining.Try it: