views:

223

answers:

2

Hi,

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.

A: 

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?

Amarghosh
hi, firstly thanks for taking the time to try and help me.I have removed the implicit resultType, and put the dataprovider in the format you suggested.But the item renderer now shows nothing.
Craig Mc
I have also tried "{new XMLListCollection(XMLList(getSpeedDialList.lastResult).SDLIST.charlist)}
Craig Mc
@Craig I didn't ask you to remove `resultFormat="e4x"` - I said `you shouldn't explicitly mention that in the e4x query.` - I meant to say remove the SDLIST from the e4x query `SDLIST.charlist`. From your other post, it looks like that's exactly how you got it working in the end.
Amarghosh
A: 

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.

Craig Mc