title: jsTree 3 - select next / previous node of dynamically loaded tree
body: <p>I have a jsTree with lazy loading. I want to be able to select the next and previous nodes using an external function. The api suggests tree.get_next_dom() but this only seem to work on nodes that have already been loaded, not ones that may require loading first.</p>
  
  <pre><code>$("[href='#next']").click(function () {
      var tree = $('#container').jstree(true),
          curr = tree.get_selected(false);
      tree.deselect_all();
      var n = tree.get_next_dom(curr);
      tree.select_node(n);
  });
  </code></pre>
  
  <p>see full fiddle for a example showing the lazy load .. 
  <a href="http://jsfiddle.net/6L7twnka/3/" rel="nofollow">http://jsfiddle.net/6L7twnka/3/</a></p>
  
  <p>So "next" would see if the node had children and then expand it, loading if required. Previous would have to look at get_prev_dom and then expand it and then possibly expand all the last nodes inside it (recursively) in order to then put the selection on the most immediately previous node. I got a bit lost trying to do this.</p>