You are here

addNode

The addNode(node) method adds an existing node as a child of this node.

Note: Any unsaved property changes will be lost when this method is called. To preserve property changes call save() first.

Parameters

node
The node to add as a child of the current node.

Returns

void

Example

var dir = companyhome.createNode("SUB_FOLDER", "cm:folder");

var properties = new Array();
properties['cm:title'] = "Node title";
properties['cm:description'] = "Node description";

var node = companyhome.createNode("SUPER_FILE.TXT", "cm:content", properties);
node.content = "Node content";

// now add as child of sub folder

dir.addNode(node);    
model.node = node;