docs/Script API/interfaces/Frontend_Script_API._internal_.FancytreeNode.html
A FancytreeNode represents the hierarchical data model and operations.
interface FancytreeNode {
children: FancytreeNode[];
data: any;
expanded: boolean;
extraClasses: string;
folder: boolean;
icon: string;
key: string;
lazy: boolean;
parent: FancytreeNode;
span: HTMLElement;
statusNodeType: string;
title: string;
tooltip: string;
tr: HTMLTableRowElement;
tree: Fancytree;
unselectable?: boolean;
unselectableIgnore?: boolean;
unselectableStatus?: boolean;
addChildren(
children: NodeData[],
insertBefore?: FancytreeNode,
): FancytreeNode;
addChildren(children: NodeData[], insertBefore?: string): FancytreeNode;
addChildren(children: NodeData[], insertBefore?: number): FancytreeNode;
addChildren(child: NodeData, insertBefore?: FancytreeNode): FancytreeNode;
addChildren(child: NodeData, insertBefore?: string): FancytreeNode;
addChildren(child: NodeData, insertBefore?: number): FancytreeNode;
addClass(className: string): void;
addNode(node: NodeData, mode?: string): FancytreeNode;
applyPatch(patch: NodePatch): JQueryPromise<any>;
collapseSiblings(): JQueryPromise<any>;
copyTo(
node: FancytreeNode,
mode?: string,
map?: (node: NodeData) => void,
): FancytreeNode;
countChildren(deep?: boolean): number;
debug(msg: any): void;
editCreateNode(mode?: string, init?: Object): void;
editEnd(applyChanges: boolean): void;
editStart(): void;
findAll(match: string): FancytreeNode[];
findAll(match: (node: FancytreeNode) => boolean): FancytreeNode[];
findFirst(match: string): FancytreeNode;
findFirst(match: (node: FancytreeNode) => boolean): FancytreeNode;
fixSelection3AfterClick(): void;
fixSelection3FromEndNodes(): void;
fromDict(dict: NodeData): void;
getChildren(): FancytreeNode[];
getCloneList(includeSelf?: boolean): FancytreeNode[];
getFirstChild(): FancytreeNode;
getIndex(): number;
getIndexHier(): string;
getKeyPath(excludeSelf: boolean): string;
getLastChild(): FancytreeNode;
getLevel(): number;
getNextSibling(): FancytreeNode;
getParent(): FancytreeNode;
getParentList(includeRoot: boolean, includeSelf: boolean): FancytreeNode[];
getPrevSibling(): FancytreeNode;
hasChildren(): boolean;
hasFocus(): boolean;
info(msg: string): void;
isActive(): boolean;
isChildOf(otherNode: FancytreeNode): boolean;
isClone(): boolean;
isDescendantOf(otherNode: FancytreeNode): boolean;
isEditing(): boolean;
isExpanded(): boolean;
isFirstSibling(): boolean;
isFolder(): boolean;
isLastSibling(): boolean;
isLazy(): boolean;
isLoaded(): boolean;
isLoading(): boolean;
isRootNode(): boolean;
isSelected(): boolean;
isStatusNode(): boolean;
isTopLevel(): boolean;
isUndefined(): boolean;
isVisible(): boolean;
load(forceReload?: boolean): JQueryPromise<any>;
makeVisible(opts?: Object): JQueryPromise<any>;
moveTo(
targetNode: FancytreeNode,
mode: string,
map?: (node: FancytreeNode) => void,
): void;
navigate(where: number, activate?: boolean): JQueryPromise<any>;
remove(): void;
removeChild(childNode: FancytreeNode): void;
removeChildren(): void;
removeClass(className: string): void;
render(force?: boolean, deep?: boolean): void;
renderStatus(): void;
renderTitle(): void;
reRegister(key: string, refKey: string): boolean;
resetLazy(): void;
scheduleAction(mode: string, ms: number): void;
scrollIntoView(effects?: boolean, options?: Object): JQueryPromise<any>;
scrollIntoView(effects?: Object, options?: Object): JQueryPromise<any>;
setActive(flag?: boolean, opts?: Object): JQueryPromise<any>;
setExpanded(flag?: boolean, opts?: Object): JQueryPromise<any>;
setFocus(flag?: boolean): void;
setSelected(flag?: boolean): void;
setStatus(status: string, message?: string, details?: string): void;
setTitle(title: string): void;
sortChildren(
cmp?: (a: FancytreeNode, b: FancytreeNode) => number,
deep?: boolean,
): void;
toDict(recursive?: boolean, callback?: (dict: NodeData) => void): NodeData;
toggleClass(className: string, flag?: boolean): boolean;
toggleExpanded(): void;
toggleSelected(): void;
visit(fn: (node: FancytreeNode) => any, includeSelf?: boolean): boolean;
visitAndLoad(
fn: (node: FancytreeNode) => any,
includeSelf?: boolean,
): JQueryPromise<any>;
visitParents(
fn: (node: FancytreeNode) => any,
includeSelf?: boolean,
): boolean;
warn(msg: any): void;
}
childrendataexpandedextraClassesfoldericonkeylazyparentspanstatusNodeTypetitletooltiptrtreeunselectable?unselectableIgnore?unselectableStatus?
addChildrenaddClassaddNodeapplyPatchcollapseSiblingscopyTocountChildrendebugeditCreateNodeeditEndeditStartfindAllfindFirstfixSelection3AfterClickfixSelection3FromEndNodesfromDictgetChildrengetCloneListgetFirstChildgetIndexgetIndexHiergetKeyPathgetLastChildgetLevelgetNextSiblinggetParentgetParentListgetPrevSiblinghasChildrenhasFocusinfoisActiveisChildOfisCloneisDescendantOfisEditingisExpandedisFirstSiblingisFolderisLastSiblingisLazyisLoadedisLoadingisRootNodeisSelectedisStatusNodeisTopLevelisUndefinedisVisibleloadmakeVisiblemoveTonavigateremoveremoveChildremoveChildrenremoveClassrenderrenderStatusrenderTitlereRegisterresetLazyscheduleActionscrollIntoViewsetActivesetExpandedsetFocussetSelectedsetStatussetTitlesortChildrentoDicttoggleClasstoggleExpandedtoggleSelectedvisitvisitAndLoadvisitParentswarn
children: FancytreeNode[]
Array of child nodes. For lazy nodes, null or undefined means 'not yet loaded'. Use an empty array to define a node that has no children.
data: any
Contains all extra data that was passed on node creation
expanded: boolean
Use isExpanded(), setExpanded() to access this property.
extraClasses: string
Addtional CSS classes, added to the node's <span>.
folder: boolean
Folder nodes have different default icons and click behavior. Note: Also non-folders may have children.
icon: string
Icon of the tree node.
key: string
Node id (must be unique inside the tree)
lazy: boolean
True if this node is loaded on demand, i.e. on first expansion.
parent: FancytreeNode
The parent node
span: HTMLElement
Outer element of single nodes
statusNodeType: string
null or type of temporarily generated system node like 'loading', or 'error'.
title: string
Display name (may contain HTML)
tooltip: string
Alternative description used as hover banner
tr: HTMLTableRowElement
Outer element of single nodes for table extension
tree: Fancytree
The tree instance
Optionalunselectableunselectable?: boolean
OptionalunselectableIgnoreunselectableIgnore?: boolean
OptionalunselectableStatusunselectableStatus?: boolean
addChildren(children: NodeData[], insertBefore?: FancytreeNode): FancytreeNode
Append (or insert) a list of child nodes.
array of child node definitions (also single child accepted)
OptionalinsertBefore: FancytreeNodechild node to insert nodes before. If omitted, the new children is appended.
The first child added.
addChildren(children: NodeData[], insertBefore?: string): FancytreeNode
Append (or insert) a list of child nodes.
array of child node definitions (also single child accepted)
OptionalinsertBefore: stringkey of the child node to insert nodes before. If omitted, the new children is appended.
The first child added.
addChildren(children: NodeData[], insertBefore?: number): FancytreeNode
Append (or insert) a list of child nodes.
array of child node definitions (also single child accepted)
OptionalinsertBefore: numberindex of the child node to insert nodes before. If omitted, the new children is appended.
The first child added.
addChildren(child: NodeData, insertBefore?: FancytreeNode): FancytreeNode
Append (or insert) a single child node.
node to add
OptionalinsertBefore: FancytreeNodechild node to insert this node before. If omitted, the new child is appended.
The child added.
addChildren(child: NodeData, insertBefore?: string): FancytreeNode
Append (or insert) a single child node.
node to add
OptionalinsertBefore: stringkey of the child node to insert this node before. If omitted, the new child is appended.
The child added.
addChildren(child: NodeData, insertBefore?: number): FancytreeNode
Append (or insert) a single child node.
node to add
OptionalinsertBefore: numberindex of the child node to insert this node before. If omitted, the new child is appended.
The child added.
addClass(className: string): void
Add class to node's span tag and to .extraClasses.
class name
addNode(node: NodeData, mode?: string): FancytreeNode
Append or prepend a node, or append a child node. This a convenience function that calls addChildren()
Optionalmode: string'before', 'after', 'firstChild', or 'child' ('over' is a synonym for 'child') (default='child')
new node.
applyPatch(patch: NodePatch): JQueryPromise<any>
Modify existing child nodes.
collapseSiblings(): JQueryPromise<any>
Collapse all sibling nodes.
copyTo(
node: FancytreeNode,
mode?: string,
map?: (node: NodeData) => void,
): FancytreeNode
Copy this node as sibling or child of node.
source node
Optionalmode: string'before' | 'after' | 'child' (default='child')
Optionalmap: (node: NodeData) => voidcallback function(NodeData) that could modify the new node
new node.
countChildren(deep?: boolean): number
Count direct and indirect children.
Optionaldeep: booleanpass 'false' to only count direct children. (default=true)
debug(msg: any): void
Write to browser console if debugLevel >= 2 (prepending node info)
editCreateNode(mode?: string, init?: Object): void
[ext-edit] Create a new child or sibling node and start edit mode.
Optionalmode: string'before', 'after', or 'child' (default='child')
Optionalinit: ObjectNodeData (or simple title string)
editEnd(applyChanges: boolean): void
[ext-edit] Stop inline editing.
false: cancel edit, true: save (if modified)
editStart(): void
[ext-edit] Start inline editing of current node title.
findAll(match: string): FancytreeNode[]
Find all nodes that contain match in the title.
string to search for
findAll(match: (node: FancytreeNode) => boolean): FancytreeNode[]
Find all nodes that contain match in the title.
a function that returns true if a node is matched.
findFirst(match: string): FancytreeNode
Find first node that contains match in the title (not including self).
string to search for
findFirst(match: (node: FancytreeNode) => boolean): FancytreeNode
Find first node that contains match in the title (not including self).
a function that returns true if a node is matched.
fixSelection3AfterClick(): void
Fix selection status, after this node was (de)selected in multi-hier mode. This includes (de)selecting all children.
fixSelection3FromEndNodes(): void
Fix selection status for multi-hier mode. Only end-nodes are considered to update the descendants branch and parents. Should be called after this node has loaded new children or after children have been modified using the API.
fromDict(dict: NodeData): void
Update node data. If dict contains 'children', then also replace the hole sub tree.
getChildren(): FancytreeNode[]
Return the list of child nodes (undefined for unexpanded lazy nodes).
getCloneList(includeSelf?: boolean): FancytreeNode[]
[ext-clones] Return a list of clone-nodes or null.
OptionalincludeSelf: booleangetFirstChild(): FancytreeNode
Return the first child node or null.
getIndex(): number
Return the 0-based child index.
getIndexHier(): string
Return the hierarchical child index (1-based, e.g. '3.2.4').
getKeyPath(excludeSelf: boolean): string
Return the parent keys separated by options.keyPathSeparator, e.g. "id_1/id_17/id_32".
getLastChild(): FancytreeNode
Return the last child of this node or null.
getLevel(): number
Return node depth. 0: System root node, 1: visible top-level node, 2: first sub-level, ... .
getNextSibling(): FancytreeNode
Return the successor node (under the same parent) or null.
getParent(): FancytreeNode
Return the parent node (null for the system root node).
getParentList(includeRoot: boolean, includeSelf: boolean): FancytreeNode[]
Return an array of all parent nodes (top-down).
Include the invisible system root node. (default=false)
Include the node itself (default=false).
getPrevSibling(): FancytreeNode
Return the predecessor node (under the same parent) or null.
hasChildren(): boolean
Return true if node has children. Return undefined if not sure, i.e. the node is lazy and not yet loaded).
hasFocus(): boolean
Return true if node has keyboard focus.
info(msg: string): void
Write to browser console if debugLevel >= 1 (prepending node info)
isActive(): boolean
Return true if node is active (see also FancytreeNode.isSelected).
isChildOf(otherNode: FancytreeNode): boolean
Return true if node is a direct child of otherNode.
isClone(): boolean
[ext-clones] Return true if this node has at least another clone with same refKey.
isDescendantOf(otherNode: FancytreeNode): boolean
Return true, if node is a direct or indirect sub node of otherNode.
isEditing(): boolean
[ext-edit] Check if this node is in edit mode.
isExpanded(): boolean
Return true if node is expanded.
isFirstSibling(): boolean
Return true if node is the first node of its parent's children.
isFolder(): boolean
Return true if node is a folder, i.e. has the node.folder attribute set.
isLastSibling(): boolean
Return true if node is the last node of its parent's children.
isLazy(): boolean
Return true if node is lazy (even if data was already loaded)
isLoaded(): boolean
Return true if node is lazy and loaded. For non-lazy nodes always return true.
isLoading(): boolean
Return true if children are currently beeing loaded, i.e. a Ajax request is pending.
isRootNode(): boolean
Return true if this is the (invisible) system root node.
isSelected(): boolean
Return true if node is selected, i.e. has a checkmark set (see also FancytreeNode#isActive).
isStatusNode(): boolean
Return true if this node is a temporarily generated system node like 'loading', or 'error' (node.statusNodeType contains the type).
isTopLevel(): boolean
Return true if this a top level node, i.e. a direct child of the (invisible) system root node.
isUndefined(): boolean
Return true if node is lazy and not yet loaded. For non-lazy nodes always return false.
isVisible(): boolean
Return true if all parent nodes are expanded. Note: this does not check whether the node is scrolled into the visible part of the screen.
load(forceReload?: boolean): JQueryPromise<any>
Load all children of a lazy node if neccessary. The expanded state is maintained.
OptionalforceReload: booleanPass true to discard any existing nodes before.
makeVisible(opts?: Object): JQueryPromise<any>
Expand all parents and optionally scroll into visible area as neccessary. Promise is resolved, when lazy loading and animations are done.
Optionalopts: Objectpassed to setExpanded(). Defaults to {noAnimation: false, noEvents: false, scrollIntoView: true}
moveTo(
targetNode: FancytreeNode,
mode: string,
map?: (node: FancytreeNode) => void,
): void
Move this node to targetNode.
'child': append this node as last child of targetNode. This is the default. To be compatble with the D'n'd hitMode, we also accept 'over'. 'before': add this node as sibling before targetNode. 'after': add this node as sibling after targetNode.
Optionalmap: (node: FancytreeNode) => voidoptional callback(FancytreeNode) to allow modifcations
navigate(where: number, activate?: boolean): JQueryPromise<any>
Set focus relative to this node and optionally activate.
The keyCode that would normally trigger this move, e.g. $.ui.keyCode.LEFT would collapse the node if it is expanded or move to the parent oterwise.
Optionalactivate: boolean(default=true)
remove(): void
Remove this node (not allowed for system root).
removeChild(childNode: FancytreeNode): void
Remove childNode from list of direct children.
removeChildren(): void
Remove all child nodes and descendents. This converts the node into a leaf. If this was a lazy node, it is still considered 'loaded'; call node.resetLazy() in order to trigger lazyLoad on next expand.
removeClass(className: string): void
Remove class from node's span tag and .extraClasses.
class name
render(force?: boolean, deep?: boolean): void
This method renders and updates all HTML markup that is required to display this node in its current state.
Optionalforce: booleanre-render, even if html markup was already created
Optionaldeep: booleanalso render all descendants, even if parent is collapsed
renderStatus(): void
Update element's CSS classes according to node state.
renderTitle(): void
Create HTML markup for the node's outer (expander, checkbox, icon, and title).
reRegister(key: string, refKey: string): boolean
[ext-clones] Update key and/or refKey for an existing node.
resetLazy(): void
Remove all children, collapse, and set the lazy-flag, so that the lazyLoad event is triggered on next expand.
scheduleAction(mode: string, ms: number): void
Schedule activity for delayed execution (cancel any pending request). scheduleAction('cancel') will only cancel a pending request (if any).
scrollIntoView(effects?: boolean, options?: Object): JQueryPromise<any>
Optionaleffects: booleananimation options.
Optionaloptions: Object{topNode: null, effects: ..., parent: ...} this node will remain visible in any case, even if this is outside the scroll pane.
scrollIntoView(effects?: Object, options?: Object): JQueryPromise<any>
Optionaleffects: Objectanimation options.
Optionaloptions: Object{topNode: null, effects: ..., parent: ...} this node will remain visible in any case, even if this is outside the scroll pane.
setActive(flag?: boolean, opts?: Object): JQueryPromise<any>
Optionalflag: booleanpass false to deactivate
Optionalopts: Objectadditional options. Defaults to {noEvents: false}
setExpanded(flag?: boolean, opts?: Object): JQueryPromise<any>
Optionalflag: booleanpass false to collapse.
Optionalopts: Objectadditional options. Defaults to {noAnimation:false, noEvents:false}
setFocus(flag?: boolean): void
Set keyboard focus to this node.
Optionalflag: booleanpass false to blur.
setSelected(flag?: boolean): void
Select this node, i.e. check the checkbox.
Optionalflag: booleanpass false to deselect.
setStatus(status: string, message?: string, details?: string): void
Mark a lazy node as 'error', 'loading', or 'ok'.
'error', 'ok'
Optionalmessage: stringOptionaldetails: stringsetTitle(title: string): void
Rename this node.
sortChildren(
cmp?: (a: FancytreeNode, b: FancytreeNode) => number,
deep?: boolean,
): void
Sort child list by title.
Optionalcmp: (a: FancytreeNode, b: FancytreeNode) => numbercustom compare function(a, b) that returns -1, 0, or 1 (defaults to sort by title).
Optionaldeep: booleanpass true to sort all descendant nodes
toDict(recursive?: boolean, callback?: (dict: NodeData) => void): NodeData
Convert node (or whole branch) into a plain object. The result is compatible with node.addChildren().
Optionalrecursive: booleaninclude child nodes.
Optionalcallback: (dict: NodeData) => voidcallback(dict) is called for every node, in order to allow modifications
toggleClass(className: string, flag?: boolean): boolean
Set, clear, or toggle class of node's span tag and .extraClasses.
class name (separate multiple classes by space)
Optionalflag: booleantrue/false to add/remove class. If omitted, class is toggled.
true if a class was added
toggleExpanded(): void
Flip expanded status.
toggleSelected(): void
Flip selection status.
visit(fn: (node: FancytreeNode) => any, includeSelf?: boolean): boolean
Call fn(node) for all child nodes. Stop iteration, if fn() returns false. Skip current branch, if fn() returns "skip". Return false if iteration was stopped.
the callback function. Return false to stop iteration, return "skip" to skip this node and its children only.
OptionalincludeSelf: boolean(default=false)
visitAndLoad(
fn: (node: FancytreeNode) => any,
includeSelf?: boolean,
): JQueryPromise<any>
Call fn(node) for all child nodes and recursively load lazy children. Note: If you need this method, you probably should consider to review your architecture! Recursivley loading nodes is a perfect way for lazy programmers to flood the server with requests ;-)
the callback function. Return false to stop iteration, return "skip" to skip this node and its children only.
OptionalincludeSelf: boolean(default=false)
visitParents(fn: (node: FancytreeNode) => any, includeSelf?: boolean): boolean
Call fn(node) for all parent nodes, bottom-up, including invisible system root. Stop iteration, if fn() returns false. Return false if iteration was stopped.
the callback function. Return false to stop iteration, return "skip" to skip this node and its children only.
OptionalincludeSelf: boolean(default=false)
warn(msg: any): void
Write warning to browser console (prepending node info)
Member Visibility
ThemeOSLightDark
Properties childrendataexpandedextraClassesfoldericonkeylazyparentspanstatusNodeTypetitletooltiptrtreeunselectableunselectableIgnoreunselectableStatus Methods addChildrenaddClassaddNodeapplyPatchcollapseSiblingscopyTocountChildrendebugeditCreateNodeeditEndeditStartfindAllfindFirstfixSelection3AfterClickfixSelection3FromEndNodesfromDictgetChildrengetCloneListgetFirstChildgetIndexgetIndexHiergetKeyPathgetLastChildgetLevelgetNextSiblinggetParentgetParentListgetPrevSiblinghasChildrenhasFocusinfoisActiveisChildOfisCloneisDescendantOfisEditingisExpandedisFirstSiblingisFolderisLastSiblingisLazyisLoadedisLoadingisRootNodeisSelectedisStatusNodeisTopLevelisUndefinedisVisibleloadmakeVisiblemoveTonavigateremoveremoveChildremoveChildrenremoveClassrenderrenderStatusrenderTitlereRegisterresetLazyscheduleActionscrollIntoViewsetActivesetExpandedsetFocussetSelectedsetStatussetTitlesortChildrentoDicttoggleClasstoggleExpandedtoggleSelectedvisitvisitAndLoadvisitParentswarn