Home - Forums-.NET - FlyTreeView (ASP.NET) - Loading nodes from server on every click

FlyTreeView (ASP.NET)

Technical support and KB related to the FlyTreeView control

This forum related to following products: FlyTreeView for ASP.NET

Loading nodes from server on every click
Link Posted: 20-Apr-2006 00:39
Hello
I'm using a flytreenodeset to generate nodes on every node click.
I want the nodes to be generated each time the user clicks a father node, and i dont want them to be cached.
How can i do this?
Link Posted: 20-Apr-2006 08:47
You should clear the node.Nodes collection during postback, this will enable node to load its children again.
Link Posted: 20-Apr-2006 19:17
i need to do this in javascript, the tree page dose not do postback...
Link Posted: 20-Apr-2006 19:30
Then it does not seem to be simple and requires some client-side treeview runtime code changes.
Three major steps for this:
1) clear client-side Nodes collection, by calling node.Remove() method for every child node.
2) collapse node using node.Collapse();
3) (HERE's changes required) Manually change the state property of node to 3 (means  collapsed and not loaded).

The 3rd step is not implemented in treeview in any way. So the only way seems to be only when you have source code of the control.
Link Posted: 20-Apr-2006 20:28
To do it onbeforecollapse event?
Link Posted: 21-Apr-2006 04:42
This should raise outofrange error:

for(i=count;i>=0;i--)

try:

for(i=count - 1;i>=0;i--)
Link Posted: 26-Apr-2006 19:21
I should post it here also.
Here's final solution code for the problem:

if(window.event.eventName == \"ONBEFORECOLLAPSE\")
{
    window.event.node.State = 3;
    window.event.node.ChildrenBuilt = false;
}