3态“展开”、“折叠”和“半扩张”。树控制

发布于 2024-09-15 11:04:02 字数 203 浏览 7 评论 0原文

我想做的是进行 3 状态树扩展。

我有三个不同的图标“展开”“折叠”“半展开”,我想用它们来显示部分填充的树控件,所有节点都初始化为半展开状态,然后单击“半展开”图标从服务器获取数据并填充树并使用“展开”图标打开该分支。

我尝试寻找它,但除了三态复选框之外找不到任何接近它的东西,但不知道当树只维护两种状态时如何在三态图标上使用它。

提前致谢。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

甜中书 2024-09-22 11:04:02

我认为您正在寻找的称为延迟加载树。您可以在 Google 上搜索很多示例,但这里是一个很好的例子。

就请求的视觉部分而言(3 个不同的图标来显示分支或节点的状态) - 您可以使用自定义渲染器轻松处理该问题,方法是查看节点上的标志以了解其加载状态。

这有帮助吗?

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?

酒与心事 2024-09-22 11:04:02

三态树控件有点不常见,因此可能有点令人困惑;考虑到即使是简单的三态复选框也相对较少,用户可能不习惯它们。也许这就是为什么你没有找到这样的树控件。

因此,也许您应该考虑使用不需要三态控制的替代设计。

例如,节点可以从折叠节点开始。如果用户展开它,并且还没有数据,则显示带有文本“检索数据...”的单个子节点(以及进度轮或其他进度指示器,如果可以的话)并开始数据检索。当数据到达时,用实际数据替换该子节点。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文