title: Toggle entire jQuery jstree
body: <p>Is it possible to open and close the entire tree through a button?</p>
  
  <p>I know that in order to open all the nodes and subnodes of the tree, I have to call the open_all function like : <code>$("#tree").jstree('open_all');</code></p>
  
  <p>And in order to toggle a node : <code>$("#tree").jstree("toggle_node","#1");</code> where #1 is the id of the first child.</p>
  
  <p>But the toggle function does not expand all the subnodes of the node. Nor does it open a half-opened tree. I can call open_all and close_all on button click, but how do I find which method to call, as in figure out if the tree has to be opened or closed? </p>