AnyChart
API Reference
Still have questions?
Contact support
Top

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:

NameTypeDescription
childObject | anychart.data.Tree.DataItem | anychart.data.TreeView.DataItemChild to set.

Returns:

anychart.data.TreeView.DataItem - Self instance for method chaining.

addChildAt

Inserts a child into a specified position.

Params:

NameTypeDescription
childObject | anychart.data.Tree.DataItem | anychart.data.TreeView.DataItemChild for add.
indexnumberPosition for add child.

Returns:

anychart.data.TreeView.DataItem - Self instance for method chaining.

del

Removes from data by path specified using mapping.

Params:

NameTypeDescription
var_args*Arguments.

Returns:

anychart.data.TreeView.DataItem - Self instance for method chaining.

get

Gets value from data by path specified using mapping.

Params:

NameTypeDescription
var_args*Arguments.

Returns:

* - Value or undefined if path is invalid.

getChildAt

Gets the child by index.

Params:

NameTypeDescription
indexnumberIndex of child to find.

Returns:

anychart.data.TreeView.DataItem | undefined - Self instance for method chaining.

getChildren

Returns a copy of children array of the current data item.

Returns:

Array.<anychart.data.TreeView.DataItem> - Copy of children array.

getParent

Gets a data item's parent.

Returns:

anychart.data.TreeView.DataItem - Self instance for method chaining.

indexOfChild

Gets the index of child in a children array.

Params:

NameTypeDescription
childanychart.data.Tree.DataItem | anychart.data.TreeView.DataItemChild for getting of index.

Returns:

number - Index of child.

meta

Getter for a meta data.

Params:

NameTypeDescription
keystringKey.

Returns:

* - Value.
Setter for a meta data.

Params:

NameTypeDescription
keystringKey.
value*Value.

Returns:

* - Value.

numChildren

Returns a length of children array.

Returns:

number - Number of children.

remove

Removes data item.

Returns:

anychart.data.TreeView.DataItem - Self instance for method chaining.

removeChild

Removes data item's child.

Params:

NameTypeDescription
childanychart.data.Tree.DataItem | anychart.data.TreeView.DataItemChild to be removed.

Returns:

anychart.data.TreeView.DataItem - Self instance for method chaining.

removeChildAt

Removes child at the specified position.

Params:

NameTypeDescription
indexnumberIndex of item for removal.

Returns:

anychart.data.TreeView.DataItem - Self instance for method chaining.

removeChildren

Removes children.

Returns:

anychart.data.TreeView.DataItem - Self instance for method chaining.

set

Sets value to the data by path.

Params:

NameTypeDescription
var_args*Arguments.

Returns:

anychart.data.TreeView.DataItem - Self instance for method chaining.