Top
You are looking at an outdated 7.11.0 version of this document. Switch to the 7.14.3 version to see the up to date information.

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 current data item.
getParent()Gets a data item's parent.
indexOfChild()Gets 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 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 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 current data item.

Returns:

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

Try it:

getParent

Gets a data item's parent.

Returns:

anychart.data.Tree.DataItem - Parent.

Try it:

indexOfChild

Gets index of child in a children array.

Params:

Name Type Description
child anychart.data.Tree.DataItem Child for getting of index.

Returns:

number - Index of child.

Try it:

meta

Getter for a meta data.

Params:

Name Type Description
key string Key.

Returns:

* - Value.

Try it:

Setter for a meta data.

Params:

Name Type Description
key string Key.
value * Value.

Returns:

* - Value.

Try it:

numChildren

Returns a length of children array.

Returns:

number - Number of children.

Try it:

remove

Removes data item.

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

Removes children.

Returns:

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

Try it:

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: