Flex 4 使用带有 XML 和项目渲染器的数据组时出现问题

发布于 2024-09-18 17:34:27 字数 1260 浏览 7 评论 0原文

我有一个带有自定义项目渲染器的数据组,当我将它从 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 技术交流群。

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

发布评论

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

评论(2

可是我不能没有你 2024-09-25 17:34:27

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

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

而且您确实是从创建完成或类似的地方调用 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.

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

And you're indeed calling getSpeedDialList.send() from creation-complete or some place like that, aren't you?

吾性傲以野 2024-09-25 17:34:27

我让它工作了。

答案是设置 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.

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