ludo/jquery-treetable — pull request #97 by johnlcox (2013-07-09 18:21:03+00:00)
Title: Do not show child nodes on expand of a hidden node

This change allows hidden nodes to be set into an expanded state without their children becoming visible. When the parent node of the expanded node is eventually expanded/shown it will automatically show the hidden expanded state.

I'm using the treetable in a control with an ajax based refresh button. I track the expanded/collapsed state of all nodes and on refresh I want to put the tree back into the same expanded/collapsed state is was previously in. Currently a user could expand a top level node, expand a second level node, then collapse the top level node; if the user re-expands the top level node the second level node will still be expanded as well. If upon refresh the top level node is collapsed and the second level node is expanded, a call to expandNode on the second level node will set it to an expanded state and call _showChildren() which will cause the child nodes to display when they shouldn't.

This change calls _showChildren() from the expand() method only if the node is visible (i.e. does not have display: none). It also initializes nodes when expandNode() is called. This is to prevent the node from being recollapsed on initialization that normally occurs when the node is shown.