Navigating around jstree



Here are some methods that you probably need to know to work with jstree.


1. Get the currently selected node

var treeDivControlName = "myJsTree";

var selectedNode = $('#'+ treeDivControlName).jstree('get_selected');

2. Get the path from root to the currently selected node 

var parents = $("#" + treeDivControlName).jstree("get_path", selectedNode);

3. Creating a  new node in your tree 

$("#" + treeDivControlName).jstree("create", selectedNode, "inside", newNode.node);

4. Removing the currently selected node 

$("#" + treeDivControlName).jstree("remove", null);  // null will remove the currently selected node

Comments

Popular posts from this blog

The specified initialization vector (IV) does not match the block size for this algorithm