# Interface Fancytree

interface Fancytree {
$container : JQuery;
$div : JQuery;
focusNode : FancytreeNode ;
options : FancytreeOptions ;
rootNode : FancytreeNode ;
widget : any;
activateKey (key: string | boolean): FancytreeNode ;
applyPatch (patchList: NodePatch []): JQueryPromise <any>;
changeRefKey (oldRefKey: string, newRefKey: string): void;
clearCookies (): void;
clearFilter (): void;
count (): number;
debug (msg: any): void;
enableUpdate (enabled: boolean): void;
expandAll (flag?: boolean, options?: Object ): void;
filterBranches (filter: string): number;
filterBranches (filter: (node: FancytreeNode ) => boolean): number;
filterNodes (filter: string, leavesOnly?: boolean): number;
filterNodes (
filter: (node: FancytreeNode ) => boolean,
leavesOnly?: boolean,
): number;
findAll (
match: string | ((node: FancytreeNode ) => undefined | boolean),
): FancytreeNode [];
findNextNode (match: string, startNode?: FancytreeNode ): FancytreeNode ;
findNextNode (
match: (node: FancytreeNode ) => boolean,
startNode?: FancytreeNode ,
): FancytreeNode ;
generateFormElements (selected?: boolean, active?: boolean): void;
getActiveNode (): FancytreeNode ;
getFirstChild (): FancytreeNode ;
getFocusNode (ifTreeHasFocus?: boolean): FancytreeNode ;
getNodeByKey (key: string, searchRoot?: FancytreeNode ): FancytreeNode ;
getNodesByRef (refKey: string, rootNode?: FancytreeNode ): FancytreeNode [];
getPersistData (): PersistData ;
getRootNode (): FancytreeNode ;
getSelectedNodes (stopOnParents?: boolean): FancytreeNode [];
hasFocus (): boolean;
info (msg: any): void;
isEditing (): FancytreeNode ;
loadKeyPath (
keyPathList: string[],
callback: (node: FancytreeNode , status: string) => void,
): JQueryPromise <any>;
loadKeyPath (
keyPath: string,
callback: (node: FancytreeNode , status: string) => void,
): JQueryPromise <any>;
reactivate (): void;
reload (source?: any): JQueryPromise <any>;
render (force?: boolean, deep?: boolean): void;
setFocus (flag?: boolean): void;
toDict (
includeRoot?: boolean,
callback?: (node: FancytreeNode ) => void,
): any;
visit (fn: (node: FancytreeNode ) => any): boolean;
warn (msg: any): void;
}

- Defined in src/public/app/types-fancytree.d.ts:31

##### Index

### Properties

$container
$div
focusNode
options
rootNode
widget

### Methods

activateKey
applyPatch
changeRefKey
clearCookies
clearFilter
count
debug
enableUpdate
expandAll
filterBranches
filterNodes
findAll
findNextNode
generateFormElements
getActiveNode
getFirstChild
getFocusNode
getNodeByKey
getNodesByRef
getPersistData
getRootNode
getSelectedNodes
hasFocus
info
isEditing
loadKeyPath
reactivate
reload
render
setFocus
toDict
visit
warn

## Properties

### $container

$container: JQuery

- Defined in src/public/app/types-fancytree.d.ts:35

### $div

$div: JQuery

- Defined in src/public/app/types-fancytree.d.ts:32

### focusNode

focusNode: FancytreeNode

- Defined in src/public/app/types-fancytree.d.ts:36

### options

options: FancytreeOptions

- Defined in src/public/app/types-fancytree.d.ts:37

### rootNode

rootNode: FancytreeNode

- Defined in src/public/app/types-fancytree.d.ts:34

### widget

widget: any

- Defined in src/public/app/types-fancytree.d.ts:33

## Methods

### activateKey

- activateKey(key: string | boolean): FancytreeNode

  Activate node with a given key and fire focus and activate events. A previously activated node will be deactivated. If activeVisible option is set, all parents will be expanded as necessary. Pass key = false, to deactivate the current node only.

  #### Parameters

  - key: string | boolean

  #### Returns FancytreeNode

  activate node (null, if not found)

  - Defined in src/public/app/types-fancytree.d.ts:47

### applyPatch

- applyPatch(patchList: NodePatch []): JQueryPromise <any>

  (experimental)

  #### Parameters

  - patchList: NodePatch []

  #### Returns JQueryPromise <any>

  resolved, when all patches have been applied

  - Defined in src/public/app/types-fancytree.d.ts:53

### changeRefKey

- changeRefKey(oldRefKey: string, newRefKey: string): void

  [ext-clones] Replace a refKey with a new one.

  #### Parameters

  - oldRefKey: string
  - newRefKey: string

  #### Returns void

  - Defined in src/public/app/types-fancytree.d.ts:56

### clearCookies

- clearCookies(): void

  [ext-persist] Remove persistence cookies of the given type(s). Called like $("#tree").fancytree("getTree").clearCookies("active expanded focus selected");

  #### Returns void

  - Defined in src/public/app/types-fancytree.d.ts:60

### clearFilter

- clearFilter(): void

  [ext-filter] Reset the filter.

  #### Returns void

  - Defined in src/public/app/types-fancytree.d.ts:63

### count

- count(): number

  Return the number of nodes.

  #### Returns number

  - Defined in src/public/app/types-fancytree.d.ts:66

### debug

- debug(msg: any): void

  Write to browser console if debugLevel >= 2 (prepending tree name)

  #### Parameters

  - msg: any

  #### Returns void

  - Defined in src/public/app/types-fancytree.d.ts:69

### enableUpdate

- enableUpdate(enabled: boolean): void

  Temporarily suppress rendering to improve performance on bulk-updates.

  #### Parameters

  - enabled: boolean

  #### Returns void

  previous status

  #### Since

  2.19

  - Defined in src/public/app/types-fancytree.d.ts:215

### expandAll

- expandAll(flag?: boolean, options?: Object ): void

  Expand (or collapse) all parent nodes.

  #### Parameters

  - `Optional` flag: boolean
  - `Optional` options: Object

  #### Returns void

  - Defined in src/public/app/types-fancytree.d.ts:72

### filterBranches

- filterBranches(filter: string): number

  [ext-filter] Dimm or hide whole branches.

  #### Parameters

  - filter: string

  #### Returns number

  count

  - Defined in src/public/app/types-fancytree.d.ts:77
- filterBranches(filter: (node: FancytreeNode ) => boolean): number

  [ext-filter] Dimm or hide whole branches.

  #### Parameters

  - filter: (node: FancytreeNode ) => boolean

  #### Returns number

  count

  - Defined in src/public/app/types-fancytree.d.ts:82

### filterNodes

- filterNodes(filter: string, leavesOnly?: boolean): number

  [ext-filter] Dimm or hide nodes.

  #### Parameters

  - filter: string
  - `Optional` leavesOnly: boolean

  #### Returns number

  count

  - Defined in src/public/app/types-fancytree.d.ts:87
- filterNodes(
  filter: (node: FancytreeNode ) => boolean,
  leavesOnly?: boolean,
  ): number

  [ext-filter] Dimm or hide nodes.

  #### Parameters

  - filter: (node: FancytreeNode ) => boolean
  - `Optional` leavesOnly: boolean

  #### Returns number

  count

  - Defined in src/public/app/types-fancytree.d.ts:92

### findAll

- findAll(
  match: string | ((node: FancytreeNode ) => undefined | boolean),
  ): FancytreeNode []

  Find all nodes that matches condition.

  #### Parameters

  - match: string | ((node: FancytreeNode ) => undefined | boolean)

  #### Returns FancytreeNode []

  array of nodes (may be empty)

  - Defined in src/public/app/types-fancytree.d.ts:110

### findNextNode

- findNextNode(match: string, startNode?: FancytreeNode ): FancytreeNode

  Find the next visible node that starts with `match`, starting at `startNode` and wrap-around at the end.

  #### Parameters

  - match: string
  - `Optional` startNode: FancytreeNode

  #### Returns FancytreeNode

  matching node or null

  - Defined in src/public/app/types-fancytree.d.ts:98
- findNextNode(
  match: (node: FancytreeNode ) => boolean,
  startNode?: FancytreeNode ,
  ): FancytreeNode

  Find the next visible node that starts with `match`, starting at `startNode` and wrap-around at the end.

  #### Parameters

  - match: (node: FancytreeNode ) => boolean
  - `Optional` startNode: FancytreeNode

  #### Returns FancytreeNode

  matching node or null

  - Defined in src/public/app/types-fancytree.d.ts:104

### generateFormElements

- generateFormElements(selected?: boolean, active?: boolean): void

  Generate INPUT elements that can be submitted with html forms. In selectMode 3 only the topmost selected nodes are considered.

  #### Parameters

  - `Optional` selected: boolean
  - `Optional` active: boolean

  #### Returns void

  - Defined in src/public/app/types-fancytree.d.ts:113

### getActiveNode

- getActiveNode(): FancytreeNode

  Return the currently active node or null.

  #### Returns FancytreeNode

  - Defined in src/public/app/types-fancytree.d.ts:116

### getFirstChild

- getFirstChild(): FancytreeNode

  Return the first top level node if any (not the invisible root node).

  #### Returns FancytreeNode

  - Defined in src/public/app/types-fancytree.d.ts:119

### getFocusNode

- getFocusNode(ifTreeHasFocus?: boolean): FancytreeNode

  Return node that has keyboard focus.

  #### Parameters

  - `Optional` ifTreeHasFocus: boolean

    (default: false) (not yet implemented)

  #### Returns FancytreeNode

  - Defined in src/public/app/types-fancytree.d.ts:125

### getNodeByKey

- getNodeByKey(key: string, searchRoot?: FancytreeNode ): FancytreeNode

  Return node with a given key or null if not found.

  #### Parameters

  - key: string
  - `Optional` searchRoot: FancytreeNode

    (optional) only search below this node.

  #### Returns FancytreeNode

  - Defined in src/public/app/types-fancytree.d.ts:131

### getNodesByRef

- getNodesByRef(refKey: string, rootNode?: FancytreeNode ): FancytreeNode []

  [ext-clones] Return all nodes with a given refKey (null if not found).

  #### Parameters

  - refKey: string
  - `Optional` rootNode: FancytreeNode

    optionally restrict results to descendants of this node.

  #### Returns FancytreeNode []

  - Defined in src/public/app/types-fancytree.d.ts:137

### getPersistData

- getPersistData(): PersistData

  [ext-persist] Return persistence information from cookies Called like $("#tree").fancytree("getTree").getPersistData();

  #### Returns PersistData

  - Defined in src/public/app/types-fancytree.d.ts:140

### getRootNode

- getRootNode(): FancytreeNode

  Return the invisible system root node.

  #### Returns FancytreeNode

  - Defined in src/public/app/types-fancytree.d.ts:143

### getSelectedNodes

- getSelectedNodes(stopOnParents?: boolean): FancytreeNode []

  Return an array of selected nodes.

  #### Parameters

  - `Optional` stopOnParents: boolean

    only return the topmost selected node (useful with selectMode 3)

  #### Returns FancytreeNode []

  - Defined in src/public/app/types-fancytree.d.ts:149

### hasFocus

- hasFocus(): boolean

  Return true if the tree control has keyboard focus

  #### Returns boolean

  - Defined in src/public/app/types-fancytree.d.ts:152

### info

- info(msg: any): void

  Write to browser console if debugLevel >= 1 (prepending tree name)

  #### Parameters

  - msg: any

  #### Returns void

  - Defined in src/public/app/types-fancytree.d.ts:155

### isEditing

- isEditing(): FancytreeNode

  [ext-edit] Check if any node in this tree in edit mode.

  #### Returns FancytreeNode

  - Defined in src/public/app/types-fancytree.d.ts:158

### loadKeyPath

- loadKeyPath(
  keyPathList: string[],
  callback: (node: FancytreeNode , status: string) => void,
  ): JQueryPromise <any>

  Make sure that a node with a given ID is loaded, by traversing - and loading - its parents. This method is ment for lazy hierarchies. A callback is executed for every node as we go.

  #### Parameters

  - keyPathList: string[]

    one or more key paths (e.g. '/3/2_1/7')

  - callback: (node: FancytreeNode , status: string) => void

    callback(node, status) is called for every visited node ('loading', 'loaded', 'ok', 'error')

  #### Returns JQueryPromise <any>

  - Defined in src/public/app/types-fancytree.d.ts:165
- loadKeyPath(
  keyPath: string,
  callback: (node: FancytreeNode , status: string) => void,
  ): JQueryPromise <any>

  Make sure that a node with a given ID is loaded, by traversing - and loading - its parents. This method is ment for lazy hierarchies. A callback is executed for every node as we go.

  #### Parameters

  - keyPath: string

    a key path (e.g. '/3/2_1/7')

  - callback: (node: FancytreeNode , status: string) => void

    callback(node, status) is called for every visited node ('loading', 'loaded', 'ok', 'error')

  #### Returns JQueryPromise <any>

  - Defined in src/public/app/types-fancytree.d.ts:172

### reactivate

- reactivate(): void

  Re-fire beforeActivate and activate events.

  #### Returns void

  - Defined in src/public/app/types-fancytree.d.ts:175

### reload

- reload(source?: any): JQueryPromise <any>

  Reload tree from source and return a promise.

  #### Parameters

  - `Optional` source: any

    optional new source (defaults to initial source data)

  #### Returns JQueryPromise <any>

  - Defined in src/public/app/types-fancytree.d.ts:181

### render

- render(force?: boolean, deep?: boolean): void

  Render tree (i.e. create DOM elements for all top-level nodes).

  #### Parameters

  - `Optional` force: boolean

    create DOM elements, even is parent is collapsed (default = false)

  - `Optional` deep: boolean

    (default = false)

  #### Returns void

  - Defined in src/public/app/types-fancytree.d.ts:188

### setFocus

- setFocus(flag?: boolean): void

  #### Parameters

  - `Optional` flag: boolean

    (default = true)

  #### Returns void

  - Defined in src/public/app/types-fancytree.d.ts:191

### toDict

- toDict(includeRoot?: boolean, callback?: (node: FancytreeNode ) => void): any

  Return all nodes as nested list of NodeData.

  #### Parameters

  - `Optional` includeRoot: boolean

    Returns the hidden system root node (and its children) (default = false)

  - `Optional` callback: (node: FancytreeNode ) => void

    Called for every node

  #### Returns any

  - Defined in src/public/app/types-fancytree.d.ts:198

### visit

- visit(fn: (node: FancytreeNode ) => any): boolean

  Call fn(node) for all nodes.

  #### Parameters

  - fn: (node: FancytreeNode ) => any

    the callback function. Return false to stop iteration, return "skip" to skip this node and children only.

  #### Returns boolean

  false, if the iterator was stopped.

  - Defined in src/public/app/types-fancytree.d.ts:205

### warn

- warn(msg: any): void

  Write warning to browser console (prepending tree info)

  #### Parameters

  - msg: any

  #### Returns void

  - Defined in src/public/app/types-fancytree.d.ts:208