Convert returning value from HTTPService to ArrayCollection : HTTPService « Data Model « Flex

Home
Flex
1.Chart
2.Components
3.Container
4.Data Model
5.Development
6.Effects
7.Event
8.Graphics
9.Grid
10.Style
Flex » Data Model » HTTPServiceScreenshots 
Convert returning value from HTTPService to ArrayCollection
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
1.Use HTTPService to access phpUse HTTPService to access php
2.Access returning value from a HTTPService
3.Request response data communication with HTTPServiceRequest response data communication with HTTPService
4.Pass parameter to HTTPService
5.Use HTTPService to call Php page and pass parameter with requestUse HTTPService to call Php page and pass parameter with request
6.A url property on the HTTPService componentA url property on the HTTPService component
7.Feed returning value from HTTPService to a DataGridFeed returning value from HTTPService to a DataGrid
8.Use HTTPService to call a jsp pageUse HTTPService to call a jsp page
9.Add ItemResponder for HTTPServiceAdd ItemResponder for HTTPService
10.Use HTTPService to load an image fileUse HTTPService to load an image file
11.HTTPService fault event and result eventHTTPService fault event and result event
12.Read binary resource from HTTPService
13.Set result format of HTTPService to E4XSet result format of HTTPService to E4X
14.Use an ArrayCollection, convert the HTTPService result to an ArrayCollectionUse an ArrayCollection, convert the HTTPService result to an ArrayCollection
15.Define XML file as a URL for an HTTPService component, and bind HTTPService result directly to the chart's data provider
16.Calling HTTP services in ActionScript
17.Default Proxy Destination
18.Named Proxy Destination CompleteNamed Proxy Destination Complete
19.Atom serviceAtom service
20.RSS feed client
21.Rss readerRss reader
22.Two ways to call an HTTP service using the send() method with a parameterTwo ways to call an HTTP service using the send() method with a parameter
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.