Could you try this one in your resultHandler....


private function resultHandler( event:ResultEven t):void
{
var xmlResult:XML = XML(event. result);
var Employees:XMLListCollection = new XMLListCollection( xmlResult.table( ));
trace(Employees) ;
}






________________________________
From: jc_bad28 <jc_ba...@yahoo.com>
To: flexcoders@yahoogroups.com
Sent: Sunday, 25 October, 2009 13:30:24
Subject: [flexcoders] Can't bind XMLListCollection to Datagrid

  
I changed my webservice call to return e4x but I can't get the 
XMLListCollection to bind to the datagrid.

Here is the pertinent AS code:

[Bindable]
private var Employees:XMLListCo llection;

private function submit():void
{
EmployeeWS.GetAllEm ployees() ;
}

private function resultHandler( event:ResultEven t):void
{ 
var xmlResult:XMLList =  new XMLList(event. result);
var Employees:XMLListCo llection = new XMLListCollection( xmlResult. children( 
));
trace(Employees) ; 
}

Here is how the trace returns the XMLListCollection data:

<datas6:Employee xmlns:datas6= "DM" xmlns:soapenv= "http://schemas. 
xmlsoap.org/ soap/envelope/">
<datas6:EmployeeID> 3</datas6: EmployeeID>
<datas6:EmployeeLas tName>Badham< /datas6:Employee LastName>
<datas6:EmployeeFir stName>John< /datas6:Employee FirstName>
<datas6:EmployeeMid dleName>C. </datas6: EmployeeMiddleNa me>
<datas6:PositionTit le>Data Manager</datas6: PositionTitle>
</datas6:Employee>
<datas6:Employee xmlns:datas6= "DM" xmlns:soapenv= "http://schemas. 
xmlsoap.org/ soap/envelope/">
<datas6:EmployeeID> 4</datas6: EmployeeID>
<datas6:EmployeeLas tName>Bui< /datas6:Employee LastName>
<datas6:EmployeeFir stName>Tai< /datas6:Employee FirstName>
<datas6:EmployeeMid dleName>Tan< /datas6:Employee MiddleName>
<datas6:PositionTit le>Inserter Operator</datas6: PositionTitle>
</datas6:Employee>

Here is the datagrid code:

<mx:DataGrid id="myGrid" dataProvider= "{Employees} " height="272" y="10" 
width="603" x="167" borderStyle= "outset">
<mx:columns>
<mx:DataGridColumn headerText=" Last Name" dataField="Employee LastName" />
<mx:DataGridColumn headerText=" First Name" dataField="Employee FirstName" />
<mx:DataGridColumn headerText=" Position" dataField="Position Title"/>
</mx:columns>
</mx:DataGrid>

I've been spinning my wheels with this for 2 weeks now.  It's probably 
something simple, but I can't figure it out after googling non-stop every damn 
day.  Any help is greatly appreciated.


   


      

Reply via email to