Glaledlists:如何创建一个包含原始列表项的转换列表 +相关衍生项目
我有一个包含父项的 EventList list1
。
我想通过以下方式将其单向转换为 TreeList:
某些父项具有子项,我需要创建一个包含父项和子项的中间项列表 list2
,这样我就可以从 list2 创建一个 TreeList (我知道该怎么做)。
例如,如果 list1 = {foo1, foo2, foo3, foo4, foo5}
且 foo2
是 foo2a
和 的父级foo2b
,而 foo5
是 foo5a、foo5b、
和 foo5c
的父级,我需要以某种方式将 list1 转换
list2 = {foo1, foo2, foo2a, foo2b, foo3, foo4, foo5, foo5a, foo5b, foo5c }.
为做这个吗?我对转换列表没有太多经验。
(或者我可以绕过它,将父项列表变成 TreeList 吗?)
请帮忙,我脑子抽筋了:/
(抱歉,我昨天发布到 Gladedlists 用户论坛,但由于某种原因,我的发帖权限已被取消)被搞砸了,它从未被发送出去)
I have an EventList list1
of parent items.
I want to make a one-way-transform this into a TreeList in the following manner:
Some of the parent items have child items, and I need to create an intermediate list list2
of items containing parent and child, so that I can then create a TreeList from list2 (that I know how to do).
so for example, if list1 = {foo1, foo2, foo3, foo4, foo5}
and foo2
is the parent of foo2a
and foo2b
, and foo5
is the parent of foo5a, foo5b,
and foo5c
, I need to somehow transform list1 into
list2 = {foo1, foo2, foo2a, foo2b, foo3, foo4, foo5, foo5a, foo5b, foo5c }.
How can I do this? I don't have much experience w/ transformed lists.
(Or can I just bypass it and turn a list of parent items into a TreeList?)
Please help, I'm having a brain cramp :/
(apologies, I posted to the glazedlists user forum yesterday but for some reason my posting permission has been screwed up and it never got sent out)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当源列表包含叶(子)节点时,TreeList 效果最佳。您可能会在 CollectionList 中找到所需内容。
TreeList works best when the source list contains the leaf (child) nodes. You might get what you're looking for in CollectionList.