Hi I am new to JsTree and I got a question on event. Let's call the tree structure stuff as LeftSide and the content rendered after you click one node on the tree as RightSide. What I can do is that you click one node at LeftSide then there is a subpage will be rendered at RightSide.
Now, what I need is to click something on the RightSide (This "something" can be a node name on the LeftSide) and it will render a subpage on the RightSide as same as if you click that node on the LeftSide.
I am not sure whether I make my question clear.
The point is that I don't know how to describe my question and search it one the web. So if you don't know the exact answer, you you just tell me which direction I should search for it. (If you tell me to read the official document, please specify which part rather than the whole doc.)
Appreciate for any help!!!
You want to listen for the select_node.jstree
event, and get the selected node(s). You can then do what you want to the right side of your page.
$("#jstree_id").on('select_node.jstree', function(e) {
// gather ids of selected nodes
var selected_ids = [];
$("#jstree_id").jstree('get_selected').each(function () {
selected_ids.push(this.id);
});
// do summit with them
$('#RightSide').text('selected '+selected_ids);
});
Edited as bind
has been deprecated in favour of on
.