Convert returning value from HTTPService to ArrayCollection

<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
verticalGap="20">
<mx:Script>
import mx.utils.ArrayUtil;
</mx:Script>
<mx:HTTPService id="employeeSrv" url="employees.jsp">
<mx:request>
<deptId>{dept.selectedItem.data}</deptId>
</mx:request>
</mx:HTTPService>
<mx:ArrayCollection id="employeeAC" source="{ArrayUtil.toArray(employeeSrv.lastResult.employees.employee)}" />
<mx:HBox>
<mx:ComboBox id="dept" width="150">
<mx:dataProvider>
<mx:ArrayCollection>
<mx:source>
<mx:Object label="A" data="A para" />
<mx:Object label="B" data="B para" />
<mx:Object label="C" data="C para" />
</mx:source>
</mx:ArrayCollection>
</mx:dataProvider>
</mx:ComboBox>
<mx:Button label="Get" click="employeeSrv.send();" />
</mx:HBox>
<mx:DataGrid dataProvider="{employeeAC}" width="100%">
<mx:columns>
<mx:DataGridColumn dataField="name" headerText="Name" />
<mx:DataGridColumn dataField="phone" headerText="Phone" />
<mx:DataGridColumn dataField="email" headerText="Email" />
</mx:columns>
</mx:DataGrid>
</mx:Application>
Related examples in the same category