class anychart.data.TreeView.DataItem Improve this Doc
Mapped data item class.
Methods Overview
Data | |
addChild() | Adds a child. |
addChildAt() | Inserts a child into a specified position. |
del() | Removes from data by path specified using mapping. |
get() | Gets value from data by path specified using mapping. |
getChildAt() | Gets the child by index. |
getChildren() | Returns a copy of children array of the current data item. |
getParent() | Gets a data item's parent. |
indexOfChild() | Gets the index of child in a children array. |
meta() | Getter for a meta data. |
numChildren() | Returns a length of children array. |
remove() | Removes data item. |
removeChild() | Removes data item's child. |
removeChildAt() | Removes child at the specified position. |
removeChildren() | Removes children. |
set() | Sets value to the data by path. |
Methods Description
addChild
Adds a child.
Params:
Name | Type | Description |
---|---|---|
child | Object | anychart.data.Tree.DataItem | anychart.data.TreeView.DataItem | Child to set. |
Returns:
anychart.data.TreeView.DataItem - Self instance for method chaining.Try it:
addChildAt
Inserts a child into a specified position.
Detailed description
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.TreeView.DataItem - Self instance for method chaining.Try it:
del
Removes from data by path specified using mapping.
Params:
Name | Type | Description |
---|---|---|
var_args | * | Arguments. |
Returns:
anychart.data.TreeView.DataItem - Self instance for method chaining.Try it:
get
Gets value from data by path specified using mapping.
Params:
Name | Type | Description |
---|---|---|
var_args | * | Arguments. |
Returns:
* - Value or undefined if path is invalid.Try it:
getChildAt
Gets the child by index.
Params:
Name | Type | Description |
---|---|---|
index | number | Index of child to find. |
Returns:
anychart.data.TreeView.DataItem | undefined - Self instance for method chaining.Try it:
getChildren
Returns a copy of children array of the current data item.
Returns:
Array.<anychart.data.TreeView.DataItem> - Copy of children array.Try it:
getParent
Gets a data item's parent.
Returns:
anychart.data.TreeView.DataItem - Self instance for method chaining.Try it:
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. |
Returns:
* - Value.Try it:
numChildren
remove
Removes data item.
Detailed description
Current item is removed from parent's children and becomes an orphan.
If a child is a root element, it is removed from the tree.
Returns:
anychart.data.TreeView.DataItem - Self instance for method chaining.Try it:
removeChild
Removes data item's child.
Params:
Name | Type | Description |
---|---|---|
child | anychart.data.Tree.DataItem | anychart.data.TreeView.DataItem | Child to be removed. |
Returns:
anychart.data.TreeView.DataItem - Self instance for method chaining.Try it:
removeChildAt
Removes child at the specified position.
Params:
Name | Type | Description |
---|---|---|
index | number | Index of item for removal. |
Returns:
anychart.data.TreeView.DataItem - Self instance for method chaining.Try it:
removeChildren
Removes children.
Returns:
anychart.data.TreeView.DataItem - Self instance for method chaining.Try it:
set
Sets value to the data by path.
Params:
Name | Type | Description |
---|---|---|
var_args | * | Arguments. |
Returns:
anychart.data.TreeView.DataItem - Self instance for method chaining.Try it: