如何设置节点是分支还是叶子?
我有一棵由数组集合填充的树。我无法控制数组集合中的数据,即使节点没有子节点,它仍然具有“子节点”属性,导致我的树将每个节点视为分支。我可以对 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
有一个 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.