Stevanicus
Stevanicus

Reputation: 7761

jQuery and jsTree - select child nodes by class

Having difficulty checking (checkbox) all nodes by a specific class

here is what i have so far, i'm trying to check all the nodes that have the class checkMe

$('.MyTree').jstree('check_node', 'li.checkMe');

Unfortunately it doesnt work :)

I can only seem to check or unchecl all the nodes by doing

$('.MyTree').jstree('check_all'); //or uncheck_all

Any ideas?

Thanks in advance

Upvotes: 1

Views: 1622

Answers (1)

Stevanicus
Stevanicus

Reputation: 7761

Solution

Why do you find the solutions after you posted on SO and after hours of previous searching :)

*Check*:  
$.jstree._reference('#mytree').check_node('#id-of-node'); 

*Uncheck*:
$.jstree._reference('#mytree').uncheck_node('#id-of-node');

*Toggle check*:
$.jstree._reference('#mytree').change_state('#id-of-node');

Upvotes: 1

Related Questions