API Reference > ui-components > Tree > MutableTreeModel MutableTreeModel Class Mutable tree model which holds nodes and allows adding or removing them. Implements TreeModel Methods Name Description constructor(): MutableTreeModel changeNodeId(currentId: string, newId: string): boolean Changes the id of target node. clearChildren(parentId: undefined | string): void Removes all children for parent specified by id. computeVisibleNodes(): VisibleTreeNodes Generates flat list of visible nodes in the tree model. getChildOffset(parentId: undefined | string, childId: string): undefined | number Returns children offset in children array for specific parent. getChildren(parentId: undefined | string): undefined | SparseArray<string> Returns children for specific parent. getNode(id: string): undefined | MutableTreeModelNode Returns tree node or placeholder for node that is not loaded yet. getNode(parentId: undefined | string, childIndex: number): undefined | TreeModelNodePlaceholder | MutableTreeModelNode getRootNode(): TreeModelRootNode Returns root node of a tree. insertChild(parentId: undefined | 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: undefined | string, targetIndex: number): boolean Transfers node along with its children to a new location. removeChild(parentId: undefined | string, child: string | number): void Removes children specified by id. setChildren(parentId: undefined | string, nodeInputs: TreeModelNodeInput[], offset: number): void Sets children for parent node starting from the specific offset. setNumChildren(parentId: undefined | string, numChildren: undefined | number): void Sets the number of child nodes a parent is expected to contain. Properties Name Type Description [DRAFTABLE] boolean Defined in ui/components/src/ui-components/tree/controlled/TreeModel.ts Line 197 Last Updated: 11 June, 2024