Groups | Blog | Home
all groups > asp.net webcontrols > october 2003 >

asp.net webcontrols : Expanding Treenodes dynamically on client side


Sunny
10/6/2003 6:11:36 PM
I need to be able to expand and collapse a tree using javascript to support
synchronizing two trees on the same page without doing a post. I'm having
several problems, so can anyone tell me how to:
- reference a node properly from javascript. I do something like
tree2.getTreeNode(index) but the Expanded attribute in the object returned
is undefined. I can see that, in the treeview.htc file, the getTreeNode
method grabs a node and then does some strange stuff to it, afterwhich all
the properties in the node are undefined. How do you get a node so that its
properties can be retrieved?
- once I set the Expanded attribute on a returned node (I tried changing the
..htc to just return the node right away, and the Expanded property returns
correct), how can you get the tree to reflect this change? i.e. after
setting tree2.getTreeNode(index).expanded = true, how can you get the tree
to reflect this immediately?

Thanks

sip
10/6/2003 7:08:21 PM
Ok I found the solution to problem. The method actually returns a generic
object and you have to access the properties with getAttribute/setAttribute.
Changing the property through this setter also seems to update the tree
immediately.



[quoted text, click to view]

AddThis Social Bookmark Button