繁体   English   中英

Flex 4在XML和项目渲染器中使用数据组的问题

[英]Flex 4 Problem using datagroup with XML and item renderer

我有一个带有自定义项目渲染器的数据组,但我将其从http服务停止工作的XML绑定到XML。

我的XML:

<SDLIST>
<chartlist>
    <reportname>FACTORY STATUS</reportname>
    <reportimage>file:/D:/Work/RapidReport/Images/Charts/Vertical-Linear-Gauges.png</reportimage>
</chartlist>
<chartlist>
    <reportname>FACTORY STATUS</reportname>
    <reportimage>file:/D:/Work/RapidReport/Images/Charts/Vertical-Linear-Gauges.png</reportimage>
</chartlist>

然后是我的数据组:

<s:DataGroup x="10" y="42" width="696" height="414" itemRenderer="myComponents.ChartListComp" dataProvider="{new XMLListCollection(XML(getSpeedDialList.lastResult).SDLIST.charlist)}">

我的Http服务:

<mx:HTTPService resultFormat="e4x" id="getSpeedDialList" url="{serverURL}/Reporting/GetSpeedDial.xml" useProxy="false" method="POST" fault="Alert.show('There has been an a problem with the connection.\nPlease check your internet connnection and try again.' + getSpeedDialList.url ,'Connection Error')" showBusyCursor="true"  >

我的组件使用:

{data.reportname}

我将不胜感激,刚刚从flex 3上移了一下,我不确定这是哪里出现的问题。

预先感谢您的任何帮助。

看起来<SDLIST>是您的根标记,在这种情况下, getSpeedDialList.lastResult已经指向该节点-您不应在e4x查询中明确提及。

<s:DataGroup x="10" y="42" width="696" height="414" 
    itemRenderer="myComponents.ChartListComp" 
    dataProvider="{getSpeedDialList.lastResult.charlist}">

而且您确实是在创建完成或诸如此类的地方调用getSpeedDialList.send() ,不是吗?

我知道了。

答案是设置resultFormat =“ e4x”,然后使用{new XMLListCollection(XMLList(getSpeedDialList.lastResult).chartlist)}

问题似乎在于数据组如何期望列表。

但是,感谢Amarghosh指出使用数据组注释时,E4X的第一个节点被忽略的行为以及Adobe Flex SDK团队的XML List Collection的Alex Harui。

暂无
暂无

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

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