MutableTreeModel Class

Mutable tree model which holds nodes and allows adding or removing them.

Implements

Methods

Name Description
constructor(seed?: TreeModel): MutableTreeModel    
changeNodeId(currentId: string, newId: string): boolean Changes the id of target node.  
clearChildren(parentId: string): void Removes all children for parent specified by id.  
getChildOffset(parentId: string, childId: string): undefined | number Returns children offset in children array for specific parent.  
getChildren(parentId: string): undefined | SparseArray<string> Returns children for specific parent.  
getNode(parentId: string, childIndex: number): undefined | MutableTreeModelNode | TreeModelNodePlaceholder    
getNode(id: string): undefined | MutableTreeModelNode Returns tree node or placeholder for node that is not loaded yet.  
getRootNode(): TreeModelRootNode Returns root node of a tree.  
insertChild(parentId: string, childNodeInput: TreeModelNodeInput, offset: number): void Inserts child in the specified position.  
iterateTreeModelNodes(parentId?: string): IterableIterator<MutableTreeModelNode> Iterates over all nodes present in the tree model.  
moveNode(sourceNodeId: string, targetParentId: string, targetIndex: number): boolean Transfers node along with its children to a new location.  
removeChild(parentId: string, child: string | number): void Removes children specified by id.  
setChildren(parentId: string, nodeInputs: TreeModelNodeInput[], offset: number): void Sets children for parent node starting from the specific offset.  
setNumChildren(parentId: string, numChildren: number): void Sets the number of child nodes a parent is expected to contain.  

Properties

Name Type Description
[DRAFTABLE] boolean    

Defined in

Last Updated: 17 December, 2024