![](/img/trans.png)
[英]Binding the selected item from DataGroup (dataprovider is an XML list) to another component (FLEX 4)
[英]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.