代码之家  ›  专栏  ›  技术社区  ›  Craig Mc

使用带有XML和项目呈现器的数据组时出现Flex4问题

  •  0
  • Craig Mc  · 技术社区  · 14 年前

    我的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)}">
    

    <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升职,我不知道这是什么行为小姐。

    事先谢谢你的帮助。

    2 回复  |  直到 14 年前
        1
  •  0
  •   Amarghosh    14 年前

    看起来像 <SDLIST> 是你的根标签,在这种情况下, getSpeedDialList.lastResult 已经指向该节点-您不应该在e4x查询中显式地提到它。

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

    你真的打电话来了 getSpeedDialList.send() 从创造完成或类似的地方,不是吗?

        2
  •  0
  •   Craig Mc    14 年前

    答案是设置resultFormat=“e4x”,然后使用{newXMLListCollection(XMLList(getSpeedDialList.lastResult=获取SpeedDialList.lastResult)(图表列表)}

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

    但是感谢Amarghosh指出E4X的第一个节点是被忽略的行为,并且 adobeflexsdk团队的alexharui在使用datagroups注释时负责XML列表集合。