简体   繁体   English

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

[英]Flex: XMLList of attirubites… convert to nodes?

say I have an xmllist like this (but with many other attributes not shown for brevity): 说我有一个像这样的xmllist(但是为了简洁起见,还有许多其他属性未显示):

<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: 然后通过xmllist。@ metal访问metal属性,这将为我提供一个新的xmllist,如下所示:

white gold
yellow gold
silver

I want to convert that to an xmllist that looks like this: 我想将其转换为如下所示的xmllist:

<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. 这样,我可以将其用作组合框中的dataProvider。

Anyone know how I can do this? 有人知道我该怎么做吗?

Thanks!!! 谢谢!!!

You can set the labelField of the ComboBox as "@metal". 您可以将组合框的labelField设置为“ @metal”。 Better yet, have a custom labelFunction that changes the values in @label to title casing as required in your example. 更好的是,有一个自定义的labelFunction,可以根据示例中的要求将@label中的值更改为标题框。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM