Ashwin
Ashwin

Reputation: 12411

jstree check parent nodes

I have created a two state jstree. Since I need to make a two state tree, I am not able to select any another node relatively to a node. What I want is that when I click on a particular node then all the parent node of the selected node should also get checked.

Please help me ..

Upvotes: 2

Views: 2498

Answers (1)

MMeah
MMeah

Reputation: 1042

Bind to a handler and the node object is passed in. The tree can be traversed up to find all of the parents. The below example uses the class "jstree-open", but any other class applied to the parent will also work.

$(node).parents(".jstree-open").each(function(index){
     var theParent=$(this);
     // Apply operation to each parent
});

Upvotes: 2

Related Questions