Tree API
Last updated
Last updated
EyzyTree includes a from under the hood. Much can be done with it. But sometimes you need to do something more complicated. In this case, you can use the external API.
A external API has to be included from separately file (module). It is similar to way the Basic API.
CDN:
As ES6 module:
Using:
Arguments:
Returns:
Usage:
Description: Similar to find
method. But it returns all found nodes.
Arguments:
Returns:
Usage:
Description: Removes matched node.
Arguments:
multiple
: boolean
Returns:
TreeNode
TreeNode[]
null
Usage:
Arguments:
multiple
: boolean
Returns:
boolean
null
Usage:
Returns:
Usage:
Description: Selects matched node.
Arguments:
extendSelection
: boolean not required. For multiple mode adds the matched node to the list of selected items (it's like a selecting node via Ctrl
)
expandOnSelect
boolean, not required. select
method will try to read this property from the tree props if expandOnSelect argument is not pass
Returns:
boolean
null
Usage:
expandOnSelect
example
Description: Removes Selection for matched node.
Arguments:
multiple
: boolean
Returns:
boolean
Usage:
Description: Removes selection for all selected nodes
Description: For checkable
mode the library will combine checked nodes into an array. There are different ways to select "checked" nodes by using valueConsistsOf
argument.
ALL
(default) it will gather all "checked" nodes
BRANCH
if node has children and it is checked (and all of the children nodes are checked) then all children nodes will be excluded from the result
LEAF
returns nodes which doesn't has children nodes
WITH_INDETERMINATE
the same as ALL
plus indeterminate nodes
Arguments:
valueConsistsOf
: 'ALL' | 'BRANCH' | 'LEAF' | 'WITH_INDETERMINATE'
showDisabled
: boolean (default false)
Returns:
Usage:
Description: Sets matched node as ticked(checked).
Arguments:
multiple
: boolean
Returns:
boolean
Usage:
Description: Sets matched node as not ticked(checked).
Arguments:
multiple
: boolean
Returns:
boolean
Usage:
Description: Uncheck all ticked nodes.
Description: Sets matched node as disabled.
Arguments:
multiple
: boolean
Returns:
boolean
Usage:
Description: Sets matched node as enabled.
Arguments:
multiple
: boolean
Returns:
boolean
Usage:
Description: Sets checkbox state for matched node as enabled.
Arguments:
multiple
: boolean
Returns:
boolean
Usage:
Description: Sets checkbox state for matched node as disabled.
Arguments:
multiple
: boolean
Returns:
boolean
Usage:
Description: Expands matched node.
Arguments:
multiple
: boolean
includingDisabled
: boolean (default false).
Returns:
boolean
Usage:
Description: Collapses matched node.
Arguments:
multiple
: boolean
includingDisabled
: boolean (default false).
Returns:
boolean
Usage:
Description: It is getter/setter for the data
property of the node.
Arguments:
key
: string | object
value
: any (not required)
Returns:
undefined
data object
Usage:
Description: Checks if a node has a className
Arguments:
className
: string
Returns:
boolean
Usage:
Arguments:
Array<className>
: string[]
multiple
: boolean
Returns:
TreeNode
if node is found
null
if node is not found
Usage:
Description: The same behavior as addClass
method, but it removes classNames
Arguments:
Array<className>
: string[]
multiple
: boolean
Returns:
TreeNode
if node is found
null
if node is not found
Usage:
Description: Inserts nodes to the end of the matched node
Arguments:
nodes
: string | object | Promise
Returns:
Promiselike<TreeNode[] | null>
added nodes (always an array)
Usage:
Description: This method is similar to append
. But nodes inserting to the beginning of children list. (well ... you know, as well as jQuery :) )
Example:
Description: This method is similar to append
. But nodes inserting before matched node.
Example:
Description: This method is similar to append
. But nodes inserting after matched node.
Description: Finds nodes by specified
query
:
query
:
query
:
Description: It removes all children nodes. Also it removes isBatch
property (see )
query
:
Description: It the same as , but it returns a
In case if you want to to select multiple nodes and extend selection you need to use next hook:
criteria
:
query
:
query
:
query
:
query
:
query
:
query
:
query
:
query
:
query
:
It is impossible to set/get data for multiple nodes via this method. But it very easy to do it via
query
:
query
:
Description: It will add classNames for the node. This class will be added to the node with the class .node-content
(check )
query
:
query
:
query
:
opts
: