5 Replies Latest reply on Aug 8, 2011 8:01 PM by saisri2k2

    HTTPService, XML & Load into Datagrid

    Flexpadawan

      Hi All,

       

      This is starting to drive me batty and need some guidence. In a nutshell this is what I want to do. Also, I am compiling version 4.5.1 if that makes any difference.

       

      1.  Load XML data using HTTPservice from startup.  (In my code this works, confimed in Network Monitor, I see all the nodes, data etc.)

      2.  Load the fields into a datagrid.

       

      This example works, but in this example it's hard-coded directly into an IList.

      http://opensource.adobe.com/wiki/display/flexsdk/Spark+DataGrid

       

      I've even tried doing it from the Adobe online training video and it also failed for me.

      http://www.adobe.com/devnet/flex/videotraining/_jcr_content/bodycontent1/modal_9.content.h tml

       

      Here is my code:

      <?xml version="1.0" encoding="utf-8"?>
      <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                     xmlns:mx="library://ns.adobe.com/flex/mx"
                     xmlns:s="library://ns.adobe.com/flex/spark"              
                     xmlns:mx2="library://ns.adobe.com/flex/halo"
                     creationComplete="startPriceService.send()">
          <fx:Declarations>
              <s:HTTPService id="startPriceService" url="startingPrice.xml" showBusyCursor="true"/>   (This part works 100%)
          </fx:Declarations>
          <s:DataGrid x="21" y="54" dataProvider="{startPriceService.lastResult.revData.revenue}">
              <s:columns>
                  <s:ArrayList>
                      <s:GridColumn dataField="revName"    headerText="Name"></s:GridColumn>
                      <s:GridColumn dataField="revTitle"       headerText="Title"></s:GridColumn>
                      <s:GridColumn dataField="revAmount" headerText="Amount"></s:GridColumn>
                  </s:ArrayList>
              </s:columns>
          </s:DataGrid>
      </s:Application>

       

       

      When I compile and run I get this error. 

      TypeError: Error #1034: Type Coercion failed: cannot convert mx.utils::ObjectProxy@18302401 to mx.collections.IList.
          at Function/<anonymous>()[/Users/bbudge03/Documents/Adobe Flash Builder 4.5.1/Sandbox/src/index.mxml:10]
          at Function/http://adobe.com/AS3/2006/builtin::apply()
          at mx.binding::Binding/wrapFunctionCall()[E:\dev\4.5.1\frameworks\projects\framework\src\mx\ binding\Binding.as:385]
          at mx.binding::Binding/innerExecute()[E:\dev\4.5.1\frameworks\projects\framework\src\mx\bind ing\Binding.as:459]
          at Function/http://adobe.com/AS3/2006/builtin::apply()
          at mx.binding::Binding/wrapFunctionCall()[E:\dev\4.5.1\frameworks\projects\framework\src\mx\ binding\Binding.as:385]
          at mx.binding::Binding/execute()[E:\dev\4.5.1\frameworks\projects\framework\src\mx\binding\B inding.as:321]
          at mx.binding::Binding/watcherFired()[E:\dev\4.5.1\frameworks\projects\framework\src\mx\bind ing\Binding.as:501]
          at mx.binding::Watcher/notifyListeners()[E:\dev\4.5.1\frameworks\projects\framework\src\mx\b inding\Watcher.as:311]
          at mx.binding::PropertyWatcher/eventHandler()[E:\dev\4.5.1\frameworks\projects\framework\src \mx\binding\PropertyWatcher.as:377]
          at flash.events::EventDispatcher/dispatchEventFunction()
          at flash.events::EventDispatcher/dispatchEvent()
          at mx.rpc::AbstractInvoker/http://www.adobe.com/2006/flex/mx/internal::resultHandler()[E:\dev\4.5.1\frameworks\projec ts\rpc\src\mx\rpc\AbstractInvoker.as:315]
          at mx.rpc::Responder/result()[E:\dev\4.5.1\frameworks\projects\rpc\src\mx\rpc\Responder.as:5 6]
          at mx.rpc::AsyncRequest/acknowledge()[E:\dev\4.5.1\frameworks\projects\rpc\src\mx\rpc\AsyncR equest.as:84]
          at DirectHTTPMessageResponder/completeHandler()[E:\dev\4.5.1\frameworks\projects\rpc\src\mx\ messaging\channels\DirectHTTPChannel.as:451]
          at flash.events::EventDispatcher/dispatchEventFunction()
          at flash.events::EventDispatcher/dispatchEvent()
          at flash.net::URLLoader/onComplete()

       

       

       

      Thanks in Advance!

      Flexpadawan