Flex 4 使用带有 XML 和项目渲染器的数据组时出现问题
我有一个带有自定义项目渲染器的数据组,当我将它从 http 服务绑定到 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升级,我不确定这是哪里的行为缺失。
预先感谢您的帮助。
I have a Datagroup with a custom item renderer the momment I bind it to XML from an http service it stops working.
My 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>
Then My DataGroup:
<s:DataGroup x="10" y="42" width="696" height="414" itemRenderer="myComponents.ChartListComp" dataProvider="{new XMLListCollection(XML(getSpeedDialList.lastResult).SDLIST.charlist)}">
My Http Service:
<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" >
My Component uses:
{data.reportname}
I would apreciate anyhelp, having just moved up from flex 3 I m not sure where this is miss behaving.
Thank you in advance for any help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
看起来
是您的根标记,在这种情况下,getSpeedDialList.lastResult
已经指向该节点 - 您不应该在 e4x 查询中明确提及这一点。而且您确实是从创建完成或类似的地方调用
getSpeedDialList.send()
,不是吗?Looks like
<SDLIST>
is your root tag, in that case,getSpeedDialList.lastResult
already points to that node - you shouldn't explicitly mention that in the e4x query.And you're indeed calling
getSpeedDialList.send()
from creation-complete or some place like that, aren't you?我让它工作了。
答案是设置 resultFormat="e4x",然后使用 {new XMLListCollection(XMLList(getSpeedDialList.lastResult).chartlist)}
问题似乎在于数据组如何期望列表。
但感谢 Amargosh 指出 E4X 第一个节点被忽略的行为并指出
Adobe Flex SDK 团队的 Alex Harui 对使用数据组时的 XML 列表集合进行了评论。
I got it to work.
The answer was to set resultFormat="e4x" and then to use {new XMLListCollection(XMLList(getSpeedDialList.lastResult).chartlist)}
the problem seems to be with how datagroups Expect Lists.
But thank you Amarghosh for pointing out the E4X first node is ignored behavior and to
Alex Harui at Adobe Flex SDK Team for the XML List Collection when using datagroups comment.