如何设置节点是分支还是叶子?

发布于 2024-09-02 22:31:22 字数 215 浏览 0 评论 0原文

我有一棵由数组集合填充的树。我无法控制数组集合中的数据,即使节点没有子节点,它仍然具有“子节点”属性,导致我的树将每个节点视为分支。我可以对 Children 属性中数组的长度进行简单检查。如果这是 0,我需要树将节点显示为叶子,没有公开图标。关于如何实现这一目标有什么想法吗?如果有像 iconFunction 和 labelFunction 这样的branchFunction 就好了。

提前致谢

I have a tree being populated by an array collection. I don't have control of the data in the array collection and even when a node has no children it still has a "children" property that is causing my tree to treat every node as branch. I can do a simple check on the length of the array in the children property. If this is 0 I need the tree to display the node as a leaf, no disclosure icon. Any thoughts on how I can achieve this? It would be nice if there were a branchFunction like the iconFunction and labelFunction.

Thanks in advance

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

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

发布评论

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

评论(1

淡看悲欢离合 2024-09-09 22:31:22

有一个 dataDescriptor 属性,允许您提供一个类来确定如何解析节点和分支。您将需要实现 ITreeDataDescriptor 或 ITreeDataDescriptor2 接口。

There is a dataDescriptor property that allows you to provide a class to determine how nodes and branches are parsed. You will need to implement the ITreeDataDescriptor or ITreeDataDescriptor2 interface.

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