2 Replies Latest reply on Sep 1, 2007 7:32 PM by LinkMc

    DataGrids, ArrayCollections, Ohh My

    LinkMc
      Hello, I am new to flex and Actionscript, and have been working with flex 3 with as3. I am using the flex builder 3 beta 1. I have only been working with in this environment for only about a month so please be patient. I do have experience in ColdFusion, MYSQL, and basic web technologies such as CSS, HTML, a little JS.

      So here is my problem.

      my current project is a custom CMS - being Customer Management Softeware.

      <mx:RemoteObject id="customer_RO" destination="ColdFusion" source="cms.cfc.customerConnection">
      <mx:method name="getCustomers" result="customerHandler(event)"/>
      <mx:method name="getContacts" result="contactHandler(event)"/>
      </mx:RemoteObject>

      <mx:Script>
      <![CDATA[

      /* Creates Bindable Array variable for the Customer List */
      [Bindable]
      private var CustomerList:ArrayCollection;
      [Bindable]
      private var ContactList:ArrayCollection;


      /* Creates an application initialization to load before application loaded */
      private function initApp():void
      {
      customer_RO.getCustomers();
      customer_RO.getContacts();
      }

      /* Created data handlers for the remoteObject method */

      private function customerHandler(event:ResultEvent):void
      {
      CustomerList = ArrayCollection(event.result);
      }

      private function contactHandler(event:ResultEvent):void
      {
      ContactList = ArrayCollection(event.result);

      }
      ]]>
      </mx:Script>


      Now here are my data grids.

      <mx:DataGrid id="dg1" x="0" y="0" width="100%" height="100%" dataProvider="{CustomerList}">
      <mx:columns>
      <mx:DataGridColumn headerText="Name" dataField="companyname" width="250"/>
      <mx:DataGridColumn headerText="Address" dataField="street1"/>
      <mx:DataGridColumn headerText="City" dataField="city" width="100"/>
      <mx:DataGridColumn headerText="State" dataField="statecode" width="50"/>

      </mx:columns>
      </mx:DataGrid>
      <mx:DataGrid x="0" y="0" width="100%" height="100%" dataProvider="{ContactList}">
      <mx:columns>
      <mx:DataGridColumn headerText="Name" dataField="firstname" width="150"/>
      <mx:DataGridColumn headerText="Email" dataField="address" width="175"/>
      <mx:DataGridColumn headerText="Phone" dataField="phonenumber" width="175"/>
      </mx:columns>
      </mx:DataGrid>