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

OpenCover code coverage for .Net Core

Android Programmatically apply style to your view

Using Custom DLL with IronPython / Scripts