4
可能是一个新手的问题,但通过“网看后,仍然无法找到答案......我有一个这样的XML对象:如何将xml节点值绑定到Flex中的下拉数据字段?
<questionpools>
<questionpool id="1">
<name>Sample test bank</name>
<description>This is a Sample test bank description</description>
<createdate>2010.10.10</createdate>
<moddate>2010.10.11</moddate>
<createdby>testuser</createdby>
<modby>testuser</modby>
</questionpool>
<questionpool id="2">
<name>alme</name>
<description>newpool</description>
<createdate>2010.10.31</createdate>
<moddate>2010.10.31</moddate>
<createdby>testuser</createdby>
<modby>testuser</modby>
</questionpool>
<questionpool id="9">
<name>pool_new</name>
<description>newpool</description>
<createdate>2010.10.31</createdate>
<moddate>2010.10.31</moddate>
<createdby>testuser</createdby>
<modby>testuser</modby>
</questionpool>
我这个文件加载到一个XML变量:
var poolMenuXML:XMLList = questionpoolsXML.questionpools;
poolMenu = new XMLListCollection(poolMenuXML.children());
和 '名称' 节点绑定到一个下拉列表的标签字段
<s:DropDownList id="s_poolnumber" dataProvider="{poolMenu}" labelField="name"></s:DropDownList>
但如何将id属性添加为下拉菜单的“数据”字段,因此当选择某个项目时,它会返回该字段?
要我创建使用@id属性为“数据”的值的源的定制组件? (我也尝试添加节点的思维,这可能有助于可惜就是不工作,要么...)
感谢 彼得
谢谢,它的工作原理! (现在我只需要找到一种方法来过滤XMLListCollection来设置下拉值 - 相同的东西,反之亦然) – Peter 2010-11-03 19:38:03