0 Replies Latest reply on Apr 4, 2007 2:31 PM by JoeADSK

    Coldfusion/Flex Wizard to Chart... Query call?

    JoeADSK Level 1
      I am doing the coldfusion/flex wizard art tutorial, and I created a master page (called ChartTest) with a

      query:
      SELECT ARTNAME, PRICE
      FROM ART (simple enough right?)

      Here is the ChartTest.mxml file:
      <?xml version="1.0" encoding="utf-8"?>
      <cfComponents:SizeableTitleWindow xmlns:mx=" http://www.adobe.com/2006/mxml" xmlns="*"
      xmlns:cfComponents="com.adobe.ColdFusion.components.*"
      creationComplete="initComponent()"
      title="ChartTest"
      showCloseButton="true" close="WindowManager.remove(this);" >

      <mx:Script>
      <![CDATA[
      import com.adobe.windowedApplication.managers.WindowManager;
      import mx.core.UIComponent;
      import mx.collections.ArrayCollection;
      import mx.utils.ObjectUtil;
      import mx.controls.Alert;
      import mx.rpc.events.FaultEvent;
      import mx.rpc.events.ResultEvent;
      private var currentIndex:int = 0;

      private var _key:Object;

      [Bindable]
      public function get key():Object
      {
      return this._key;
      }
      public function set key(key:Object):void
      {
      this._key = key;
      }

      private function initComponent():void
      {
      refreshList(null);
      }

      public function refreshList(event:Event):void
      {
      this.dataManager.getMasterQuery(this.key);
      }

      /**
      * RemoteObject result and error handlers
      */
      private function server_fault(event:FaultEvent):void
      {
      // dump error message
      Alert.show( ObjectUtil.toString(event.fault) );
      }

      private function getMasterQuery_result(event:ResultEvent):void
      {
      //Alert.show( ObjectUtil.toString(event.result) );
      this.masterList.dataProvider = event.result as ArrayCollection;
      this.masterList.selectedIndex = this.currentIndex;
      }

      private function deleteItem_result(event:ResultEvent):void
      {
      //Alert.show( ObjectUtil.toString(event.result) );
      refreshList(null);
      }
      ]]>
      </mx:Script>

      <mx:RemoteObject
      id="dataManager"
      showBusyCursor="true"
      destination="ColdFusion" source="ArtExample.components.cfgenerated.ChartTest">
      <mx:method name="getMasterQuery" result="getMasterQuery_result(event)" fault="server_fault(event)" />
      <mx:method name="deleteItem" result="deleteItem_result(event)" fault="server_fault(event)" />
      </mx:RemoteObject>

      <mx:HBox width="100%" height="100%">

      <mx:ColumnChart id="Chart" dataProvider="{}">
      <mx:series>
      <mx:ColumnSeries id="C1"
      displayName="Price"
      yField="PRICE"
      xField="ARTNAME"
      />

      </mx:series>
      </mx:ColumnChart>

      <mx:Legend dataProvider="{Chart}"/>

      <mx:DataGrid
      id="masterList"
      width="100%" height="100%" top="0" left="0" right="0" bottom="0">
      <mx:columns>
      <mx:DataGridColumn dataField="ARTNAME" headerText="ARTNAME" />
      <mx:DataGridColumn dataField="PRICE" headerText="PRICE" />
      </mx:columns>
      </mx:DataGrid>

      </mx:HBox>

      </cfComponents:SizeableTitleWindow>

      Im not sure what the data grid uses as a call, it doesnt have a "dataProvider".
      Can somebody enlighten me? Thanks!