Node API
Introducing
This is a search result. You cannot to get an access directly. It works like in jQuery: find some node (via Query) and do some action with the found node(s).
Methods which retruns this API:
Methods
find
findAll
Description: Similar to
find
method. But it returns all found nodes.Arguments:
query
: Query
Returns:
Usage:
remove
Description: Removes matched node.
Returns:
TreeNode
TreeNode[]
null
Usage:
empty
Description: It removes all children nodes. Also it removes
isBatch
property (see Acync)Returns:
boolean
null
Usage:
select
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 viaCtrl
)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
unselect
Description: Removes Selection for matched node.
Returns:
boolean
Usage:
check
Description: Sets matched node as ticked(checked).
Returns:
boolean
Usage:
uncheck
Description: Sets matched node as not ticked(checked).
Returns:
boolean
Usage:
disable
Description: Sets matched node as disabled.
Returns:
boolean
Usage:
enable
Description: Sets matched node as enabled.
Returns:
boolean
Usage:
enableCheckbox
Description: Sets checkbox state for matched node as enabled.
Returns:
boolean
Usage:
disableCheckbox
Description: Sets checkbox state for matched node as disabled.
Returns:
boolean
Usage:
expand
Description: Expands matched node.
Arguments:
includingDisabled
: boolean (default false).
Returns:
boolean
Usage:
collapse
Description: Collapses matched node.
Arguments:
includingDisabled
: boolean (default false).
Returns:
boolean
Usage:
data
You can store here whatever you want.
Description: It is getter/setter for the
data
property of the node.Arguments:
key
: string | objectvalue
: any (not required)
Returns:
undefined
data object
TreeNode
Usage:
How to set/get data for multiple nodes?
hasClass
Description: Checks if a node has a
className
Arguments:
className
: string
Returns:
boolean
Usage:
addClass
Description: It will add classNames for the node. This class will be added to the node with the class
.node-content
(check Node's structure)Arguments:
Array<className>
: string[]
Returns:
TreeNode
if node is found
Usage:
removeClass
Description: The same behavior as
addClass
method, but it removes classNamesArguments:
Array<className>
: string[]
Returns:
boolean
Usage:
append
Description: Inserts nodes to the end of the matched node
Arguments:
nodes
: string | object | Promiseopts
: Insertion options
Returns:
Promiselike<TreeNode[]>
added nodes (always an array)
Usage:
prepend
Description: This method is similar to
append
. But nodes inserting to the beginning of children list. (well ... you know, as well as jQuery :) )Example:
before
Description: This method is similar to
append
. But nodes inserting before matched node.Example:
after
Description: This method is similar to
append
. But nodes inserting after matched node.
Last updated