Inserts a node or nodes before node before.
insert([parent], before, nodes)

parent | string, id of the node (optional)
before | string or object, id of the node or node object
nodes | object or array, sidebar nodes to add

Returns object.

#### Description

The nodes argument can be either an object or array of objects. If it is an object it represents a sidebar node that will be added to .nodes array of the parent node. If it is an array then each element of the array will be treated as a separate sidebar node object.
The first optional argument parent is an id of the parent node or parent node itself. If parent node is not specified, new nodes will be inserted to the parent of the before node.
New nodes will be inserted before node before, which is an id of the node or node object. If you want to append nodes, the before argument should be null. You can also use .add() method.
This method returns last inserted node object.
If you defined the object in the following way: $('#sidebar').w2sidebar({ name : 'sidebar', img : 'icon-page', nodes: [ { id: 'id-1', text: 'Level 1' }, { id: 'id-2', text: 'Level 2' }, { id: 'id-3', text: 'Level 3' } ] }); You can: w2ui['sidebar'].insert('id-2', { id: 'id-1-1', text: 'Level 1-1' }); // or w2ui['sidebar'].insert('id-3', [ { id: 'id-2-1', text: 'Level 2-1' }, { id: 'id-2-2', text: 'Level 2-2' }, { id: 'id-2-3', text: 'Level 2-3' } ]);