I have a treeview control that's first being populated with a list of
items. Each item has sub nodes, and sub nodes have sub nodes. It
takes a while to load the whole thing, so I decided the better approach
was just to load the items for the node that's currently selected.
The problem with this approach is the nodes aren't showing the
plus/minus signs next to them until they are populated. Thus there's
no cue to the user that more is available under them.
What's the best approach to handling this? I could hack something
together by going through and adding a dummy node under each parent,
then clearing it before populating it with the real thing, but it seems
like there has gotta be a cleaner way.
Tom Dacon - 29 Aug 2005 21:29 GMT
Your approach of adding a dummy node is the only way I know of to handle
this. I've used it a number of times and it works fine. You just need to do
careful bookkeeping on the placeholder node so that it's never seen. The
general approach of doing "lazy reads" to populate the children is good
practice from a resource and performance standpoint.
If anyone reading this thread has a better way to handle this, I'd like to
know about it myself.
Tom Dacon
Dacon Software Consulting
>I have a treeview control that's first being populated with a list of
> items. Each item has sub nodes, and sub nodes have sub nodes. It
[quoted text clipped - 9 lines]
> then clearing it before populating it with the real thing, but it seems
> like there has gotta be a cleaner way.
Richard Lionheart - 30 Aug 2005 01:03 GMT
Just an idea: Add a dummy node to each node that would have subnodes; then
trap the click on any node and if a first dubnode exists and is a dummy
node, delete the dummy and populate it with the real sub-nodes. The new
subnodes should get the same treatment.
HTH,
Richard
P.S. I accidentily sent this repy as email. Sorry
>I have a treeview control that's first being populated with a list of
> items. Each item has sub nodes, and sub nodes have sub nodes. It
[quoted text clipped - 9 lines]
> then clearing it before populating it with the real thing, but it seems
> like there has gotta be a cleaner way.