What is jsTree?
jsTree is jquery plugin, that provides interactive trees. It is absolutely free, open source and distributed under the MIT license. jsTree is easily extendable, themable and configurable, it supports HTML & JSON data sources and AJAX loading.
jsTree functions properly in either box-model (content-box or border-box), can be loaded as an AMD module, and has a built in mobile theme for responsive design, that can easily be customized. It uses jQuery's event system, so binding callbacks on various events in the tree is familiar and easy.
Just a few of the features worth noting:
- drag & drop support
- keyboard navigation
- inline edit, create and delete
- tri-state checkboxes
- fuzzy searching
- customizable node types
Invoking methods on an instance
To invoke a method on an instance you must obtain a reference of the instance and invoke the method. The example shows how to obtain a reference and invoke a method.
Check the API for a list of available methods.
// 3 ways of doing the same thing $('#jstree').jstree(true) .select_node('mn1'); $('#jstree') .jstree('select_node', 'mn2'); $.jstree.reference('#jstree') .select_node('mn3');
- Node 1
- Node 2
- Node 3