karora
karora

Reputation: 33

3-state "expanded", "collapsed" and "semi-expanded" tree control

What I'm trying to do is have a 3 state tree expansion.

I have three different icons for "expand" "collapse" "semi-expanded" which I want to use to show a partially populated tree control with all nodes initialized to semi-expanded state and then on clicking the "semi-expanded" icon it gets data from server and populates the tree and open that branch with "expanded" icon.

I tried looking for it but couldn't find anything close to it except the 3-state checkbox but don't know how to use it on 3 state icon when tree would only maintain 2 states.

Thanks in advance.

Upvotes: 1

Views: 1229

Answers (2)

BigWorld
BigWorld

Reputation: 100

I think what you are looking for is called a lazy-loading tree. There are lots of examples your can google for, but here is a great example.

As far as the visual part of your request goes (3 different icons to show that state of the branch or node) - you could easily handle that with a custom renderer, by looking at a flag on the node for it's load status.

Does that help?

Upvotes: 1

oefe
oefe

Reputation: 19916

A 3-State tree control is a bit uncommon and might therefore be a bit confusing; consider that even simple 3-state checkboxes are relatively rare and users may not be accustomed to them. Maybe that's why you didn't find such a tree control.

Thus, maybe you should consider using an alternate design that doesn't require 3-state controls.

For example, the node could start in collapsed node. If the user expands it, and there is no data yet, show a single sub node with the text "retrieving data..." (and a progress wheel or other progress indicator, if you can) and start data retrieval. When the data arrives, replace this sub node with the actual data.

Upvotes: 1

Related Questions