Flex:attirubites 的 XMLList...转换为节点?
假设我有一个像这样的 xmllist (但为了简洁起见,没有显示许多其他属性):
<node metal="white gold"/>
<node metal="yellow gold"/>
<node metal="silver"/>
并且我通过 xmllist.@metal 访问金属属性,这将为我提供一个像这样的新 xmllist:
white gold
yellow gold
silver
我想将其转换为看起来像的 xmllist像这样:
<item label="White Gold" data="white gold"/>
<item label="Yellow Gold" data="yellow gold"/>
<item label="Silver" data="silver"/>
这样我可以将它用作组合框中的数据提供者。
有人知道我该怎么做吗?
谢谢!!!
say I have an xmllist like this (but with many other attributes not shown for brevity):
<node metal="white gold"/>
<node metal="yellow gold"/>
<node metal="silver"/>
and I access the metal attributes via xmllist.@metal which will give me a new xmllist like this:
white gold
yellow gold
silver
I want to convert that to an xmllist that looks like this:
<item label="White Gold" data="white gold"/>
<item label="Yellow Gold" data="yellow gold"/>
<item label="Silver" data="silver"/>
This way I can use it as a dataProvider in a combobox.
Anyone know how I can do this?
Thanks!!!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以将 ComboBox 的 labelField 设置为“@metal”。 更好的是,有一个自定义 labelFunction,可以根据示例中的需要将 @label 中的值更改为标题大小写。
You can set the labelField of the ComboBox as "@metal". Better yet, have a custom labelFunction that changes the values in @label to title casing as required in your example.