-
Notifications
You must be signed in to change notification settings - Fork 10
Creating a record
To create a new record you need to create an instance of the Model and then use one of the listed functions.
let newTag = new Tag();
newTag.label = 'New root tag';
newTag = await Tag.createRoot(newTag);
// or
await someExistingTag.addChild(newTag);
// or
await newTag.insertAsParentOf(someExistingTag);
// or another function from the listWarning! You can use these functions only with records w/o its own place in the tree (w/o left and right values in other words). If you need to move the existing records, see Moving a record page.
Let's call the Model as Model and the instance of that model as record.
Create a root node from existing or new record.
async Model.createRoot(record, options = {}): recordInsert the node (from which you call the function) as parent of destination node.
async record.insertAsParentOf(destNode, options = {})Insert the node (from which you call the function) as previous sibling of destination node.
async record.insertAsPrevSiblingOf(destNode, options = {})Insert the node (from which you call the function) as next sibling of destination node.
async record.insertAsNextSiblingOf(destNode, options = {})Insert the node (from which you call the function) as first child of destination node.
async record.insertAsFirstChildOf(destNode, options = {})Insert the node (from which you call the function) as last child of destination node.
async record.insertAsLastChildOf(destNode, options = {})Add the node as last child of the supplied node (new parent)
async record.addChild(parentNode, options = {})