Ah, yes of course, it almost certainly is.   

 

I suggest, in verbose style:

 var xmlResult:XML = e.result as XML;

 trace(xmlResult.toXMLString()); //is that the xml you expected?

 var xlResult:XMLList = xmlResult.children(); //or other expression

 trace(xlResult.length());  //is that the right expression?

 dg2data = new XMLListCollection(xlResult)

 trace(dg2data.getItemAt(0).toXMLString());  //to make It easy to know
the dataField

 

Tracy

 

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Alex Harui
Sent: Thursday, September 06, 2007 2:03 PM
To: [email protected]
Subject: RE: [flexcoders] Populating XMLListCollection and sending it to
a Datagrid

 

e.result may be XML and not XMLListCollection.

 

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Tracy Spratt
Sent: Thursday, September 06, 2007 10:28 AM
To: [email protected]
Subject: RE: [flexcoders] Populating XMLListCollection and sending it to
a Datagrid

Are you sure onResult is getting called? If so, trace out
dg2data.toXMLString() to make sure you have what you expect.  You should
see readable xml.

Make sure  "name" is a first generation child node name in the item
node.

Tracy 

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of its_llpj
Sent: Thursday, September 06, 2007 12:13 PM
To: [email protected]
Subject: [flexcoders] Populating XMLListCollection and sending it to a
Datagrid

Hello, I'm trying to populate a datagrid. Here is my code. Everything
works, but when I use the dataProvider dg2data within my datagrid it
comes back empty. I know there is data there, but not sure if I'm
missing something.

public function onSelectFirstGrid(event:Event):void

{
myRequest.addEventListener(Event.COMPLETE, onResult)
myRequest.send(dg.selectedItem.myID);
}

private function onResult(e:ResultEvent):void

{
dg2data = e.result as XMLListCollection;
}

private function onFault(e:FaultEvent):void

{
Alert.show(e.fault.message, "Could not load");
}

[Bindable]
public var dg2data: XMLListCollection;

My DataGrid
<mx:DataGrid id="dg2" width="100%" height="100%" rowCount="10"
dataProvider="{dg2data}">
<mx:columns>
<mx:DataGridColumn dataField="name" headerText="Name" />
</mx:columns>
</mx:DataGrid>

Thanks! 

 

Reply via email to