0 Replies Latest reply on Jul 20, 2007 2:10 AM by BarryGee

    Loading data into a DataGrid from multiple parts of an  xml file

    BarryGee Level 1
      Hi.

      I am using Flex Builder 2. I am trying to fill the columns of a datagrid with the contents of various parts of my xml file. The code I have so far is below.
      The location data loads fine into the appropriate column, however if i change the dataProvider details to;

      dataProvider="{feedRequest.lastResult.airshows.airshow.details}" or dataProvider="{feedRequest.lastResult.airshows.airshow.location.details}"

      i get the following error;

      Error: Unknown Property: 'details'.
      at mx.collections::ListCollectionView/ http://www.adobe.com/2006/actionscript/flash/proxy::getProperty()
      at mx.binding::PropertyWatcher/::updateProperty()
      at Function/ http://adobe.com/AS3/2006/builtin::apply()
      at mx.binding::Watcher/mx.binding:Watcher::wrapUpdate()
      at mx.binding::PropertyWatcher/updateParent()
      at mx.binding::Watcher/updateChildren()
      at mx.binding::PropertyWatcher/::updateProperty()
      at Function/ http://adobe.com/AS3/2006/builtin::apply()
      at mx.binding::Watcher/mx.binding:Watcher::wrapUpdate()
      at mx.binding::PropertyWatcher/updateParent()
      at mx.binding::Watcher/updateChildren()
      at mx.binding::PropertyWatcher/::updateProperty()
      at Function/ http://adobe.com/AS3/2006/builtin::apply()
      at mx.binding::Watcher/mx.binding:Watcher::wrapUpdate()
      at mx.binding::PropertyWatcher/updateParent()
      at mx.binding::Watcher/updateChildren()
      at mx.binding::PropertyWatcher/::updateProperty()
      at Function/ http://adobe.com/AS3/2006/builtin::apply()
      at mx.binding::Watcher/mx.binding:Watcher::wrapUpdate()
      at mx.binding::PropertyWatcher/eventHandler()
      at flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunction()
      at flash.events::EventDispatcher/dispatchEvent()
      at mx.rpc::AbstractInvoker/ http://www.adobe.com/2006/flex/mx/internal::resultHandler()
      at mx.rpc::Responder/result()
      at mx.rpc::AsyncRequest/acknowledge()
      at ::DirectHTTPMessageResponder/completeHandler()
      at flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunction()
      at flash.events::EventDispatcher/dispatchEvent()
      at flash.net::URLLoader/flash.net:URLLoader::onComplete()




      and no data loads.

      The mxml and xml file data can be seen below. All advice / code hacks welcome.

      Thanks

      Barry.

      MXML
      ----------------------------------------------------------------

      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="feedRequest.send()">

      <mx:HTTPService id="feedRequest" url=" http://www.barrygee.com/apps/AIRShows/airshows.xml" useProxy="false"/>

      <mx:Panel x="10" y="10" width="800" height="400" layout="absolute" title="AIR Shows">

      <mx:DataGrid x="20" y="20" id="dgPosts" width="740" height="320" dataProvider="{feedRequest.lastResult.airshows.airshow}">

      <mx:columns>
      <mx:DataGridColumn headerText="Location" dataField="location" width="150"/>
      <mx:DataGridColumn headerText="Name" dataField="name" width="150"/>
      <mx:DataGridColumn headerText="Frequency" dataField="frequency"/>
      <mx:DataGridColumn headerText="Low" dataField="low"/>
      <mx:DataGridColumn headerText="High" dataField="high"/>
      <mx:DataGridColumn headerText="Band" dataField="band"/>
      <mx:DataGridColumn headerText="Info" dataField="info" width="300"/>

      </mx:columns>

      </mx:DataGrid>

      </mx:Panel>

      </mx:Application>


      XML
      ---------------------------------------------------------------

      <?xml version="1.0" encoding="UTF-8" ?>

      <airshows>

      <airshow>

      <location>Sunderland. UK.</location>

      <details>

      <name>RAF Red Arrows Aerobatic Display Team</name>

      <frequency></frequency>

      <low>242.2</low>

      <high>243.45</high>

      <band>AM</band>

      <info>Sunday only. All but one of them is air to air</info>

      </details>

      <details>

      <name>RAF Red Arrows Aerobatic Display Team</name>

      <frequency></frequency>

      <low>242.05</low>

      <high>377.6</high>

      <band>AM</band>

      <info>Sunday only. All but one of them is air to air</info>

      </details>

      </airshow>

      </airshows>