Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JsTree - Expand by clicking Parent Node

Tags:

jquery

jstree

I'm using JsTree. Right now, the elements of the tree only expand when the icon NEXT to the parent node is clicked. How can I make it so the tree expands also when the parent node is clicked?

like image 207
djt Avatar asked Apr 30 '12 18:04

djt


1 Answers

The full list of commands can be found here:http://www.jstree.com/documentation/core Below is a rough implementation of the close_node and open_node listening to the click event.

.jstree({...}).delegate(".jstree-open>a", "click.jstree", function(event){
    $.jstree._reference(this).close_node(this,false,false);
}).delegate(".jstree-closed>a", "click.jstree", function(event){
    $.jstree._reference(this).open_node(this,false,false);
});
like image 173
MMeah Avatar answered Oct 22 '22 09:10

MMeah