How to open a jstree branch in javascript -


here html code :

<div id="jstree-beandesccategorie" class="jstreediv" style="display: none;">  <div class="containerjstree jstree jstree-2 jstree-default jstree-checkbox-selection" role="tree" aria-multiselectable="true" tabindex="0" aria-activedescendant="3" aria-busy="false">  <ul class="jstree-container-ul jstree-children jstree-wholerow-ul jstree-no-dots" role="group">    <li id="2" class="jstree-node jstree-closed" role="treeitem" aria-selected="false" aria-level="1" aria-labelledby="2_anchor" aria-expanded="false">    <div class="jstree-wholerow" unselectable="on" role="presentation"></div>   <i class="jstree-icon jstree-ocl" role="presentation"></i>   <a id="2_anchor" class="jstree-anchor" href="#" tabindex="-1"></a>    </li> 

when branch open class changes "jstree-node jstree-open"

i'm using tchromium embedded delphi i've tried :

 var x = document.getelementsbyclassname("jstree-node jstree-closed");  x[1].click(); 

nothing happened, although x isn't empty

you should not change classes, obtain instance , call open_node on it:

// assume "2" node id seen above // replace tree-container-here id (the 1 used create tree) window.jquery('#tree-container-id-here').jstree(true).open_node('2'); 

Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -