Flex:attirubites 的 XMLList...转换为节点?

发布于 2024-08-02 03:06:53 字数 557 浏览 10 评论 0原文

假设我有一个像这样的 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 技术交流群。

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

发布评论

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

评论(1

壹場煙雨 2024-08-09 03:06:53

您可以将 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.

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