Here is the page I'm working with:
//node event router
function nodeEvent(sender, node, type)
{
switch (type)
{
case "expanded":
nodeExpanded(sender, node);
break;
case "selected":
nodeSelected(sender, node);
break;
}
}
//handler for node expanded event
function nodeExpanded(tree, node)
{
}
//handler for node selected event
function nodeSelected(tree, node)
{
//if hidden structure node, repopulate parent's children
if (node.getValue() == "hiddenStructure")
{
repopulateChildren(node.getParent());
return;
}
var children = node.getChildNodes();
for (var i = 0; i < children.length; i++)
{
if (children[0].getValue() == "hiddenStructure")
{
repopulateChildren(node);
return;
}
}
}
function repopulateChildren(node)
{
node.collapse();
node.clearChildNodes();
node.setPopulateNodesOnDemand(true);
node.expand();
}
OnNodeSelected="FlyTreeView_NodeSelected" ContextMenuID="TreeMenu" Style="overflow: hidden" PostBackOnSelect="true"
OnNodeEventJavascript="nodeEvent">
Padding="2px;2px;2px;2px;" BorderColor="LightGray" BorderWidth="1px" BorderStyle="Solid" Font-Bold="true"/>