Array of node objects.
Array, default = []
This array contains all the node objects of the sidebar. Each node object may in turn contain other nodes thus allowing unlimited nestedness. A node object has following structure: node: { id : null, // id of the node, must be unique for the whole sidebar text : '', // text for the node, can be string or a function that returns string nodes : [], // array of sub node objects icon : null, // css class of the font icon that will appear on the left img : null, // css class of the image that will appear on the left style : '', // additional style for the node count : '', // text of the badge that will appear on the right route : null, // route for the node item selected : false, // indicates if node is selected expanded : false, // indicates if node is expanded hidden : false, // indicates if node is hidden disabled : false, // indicates is node is disabled group : false, // indicates if node is a group groupShowHide : true, // indicates if to display show/hide link for groups collapsible : true, // indicates if node can be collapsible plus : false, // if true, then + will be shown even if there is no sub nodes // events onClick : null, // mouse click event handler onDblClick : null, // mouse double click event handler onContextMenu : null, // mouse right click event handler onExpand : null, // node expand event handler onCollapse : null, // node collapsed event handler // internal parent : null, // reference to a parent node object sidebar : null // reference to the sidebar the node belongs to } You can define nodes during object creation: $('#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 should not change nodes directly during run-time. If you do change them you will need to call .refresh() method to update it on the screen (you might also need to set parent, sidebar properties of the nodes).
Use .add(), .insert(), .set(), .remove() methods to change nodes dynamically.