Try this instead:
 
categories = new ArrayCollection(event.result);

Shan 
 

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Mike Anderson
Sent: Thursday, July 27, 2006 12:57 AM
To: flexcoders@yahoogroups.com
Subject: [Junk E-Mail - LOW] RE: [flexcoders] How does Flex 2.0 handle ColdFusion Query results?

Hello Shannon :)
 
Yes, I am doing precisely that.  I was trying to avoid posting code, but it's the easiest way to show you everything I am trying to do.  You can assume too, that yes I am bringing back a valid RecordSet from ColdFusion, and the FieldNames match up exactly with what was brought back.  Since the data is all there, Flex for some reason, is not iterating through all the data and parsing it out properly.  I just have a hard time with this - since this works fine with my Flash Remoting app, and that I am bringing back a native Query Object from ColdFusion.  I must be missing something, or am not properly casting something.  As far as I can tell, I am properly coding the Grid Columns - but maybe I am not...  One last thing - I am running something similar to Flash's NetConnection Debugger - and I am for sure getting back a valid response from the CF Server - an Array of Objects, all properly formatted and casted.
 
If you could shed further light, as to why no data shows up in my DataGrid when the app runs, I'd be very grateful :)
 
Thanks - Mike
 
=====================================
 
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
  layout="absolute"
  initialize="remoteService.getCategories()">
 
 <mx:Script>
  <![CDATA[
  import mx.rpc.events.*;
  import mx.collections.*;
  
  [Bindable]
  public var categories:ArrayCollection;
  
  public function getCategories_Handler(event:ResultEvent):void
  {
   categories = new ArrayCollection(event.result as Array);
  }
  
  ]]>
 </mx:Script>
 
 <mx:RemoteObject id="remoteService"
   destination="ColdFusion"
   source="infonexus.services.infoNexus"
   showBusyCursor="true">
  <mx:method name="getCategories" result="getCategories_Handler(event)"/>
 </mx:RemoteObject>
 
 <mx:Panel left="10" top="10" bottom="10" right="10" title="Welcome to the Information Nexus">
       <mx:DataGrid id="categoriesGrid" dataProvider="{categories}" width="100%" height="100%" borderStyle="none">
      <mx:columns>
       <mx:Array>
        <mx:DataGridColumn headerText="Icon ID" dataField="IconID" />
        <mx:DataGridColumn headerText="Icon Filename" dataField="IconFileName" />
        <mx:DataGridColumn headerText="Icon Name" dataField="IconName" />
       </mx:Array>
      </mx:columns>
     </mx:DataGrid>
 </mx:Panel>
</mx:Application>


From: [EMAIL PROTECTED]ups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Shannon Hicks
Sent: Thursday, July 27, 2006 12:17 AM
To: [EMAIL PROTECTED]ups.com
Subject: RE: [flexcoders] How does Flex 2.0 handle ColdFusion Query results?

When you get a query back from a CFC via the flexgateway, you should cast it as an ArrayCollection right there...
 
someFunction(event:EventResult):void {
    myArrayCollection = event.result as ArrayCollection;
}
 
Shan


From: [EMAIL PROTECTED]ups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Mike Anderson
Sent: Thursday, July 27, 2006 12:13 AM
To: [EMAIL PROTECTED]ups.com
Subject: [flexcoders] How does Flex 2.0 handle ColdFusion Query results?

Hello All,

I finally got my Flex Remoting working properly, and now I am porting
all my Flash Applications over to Flex 2.0 as well as reusing all my
existing .CFC's (since they all worked fine for Flash Remoting).

The problem is, Flex 2.0 doesn't properly display my data - for example,
in my DataGrid control, when I set my dataProvider property. The
dataProvider variable which is bound to the DataGrid, is cast as an
"ArrayCollection" - and of course, after I get the "result" of my
Remoting Call, I set the variable to "event.result As Array".

This code works fine, for another Remoting project I am working on - but
in that project, I am sending "Typed Objects" back and forth (which
reside both in the App itself, and the ColdFusion server).

Before I start posting code, I'd like to first begin this thread by
asking a general question:

How should I cast Flex 2.0 variables, that will contain "Query" Objects
(or RecordSet Objects, for you Flashers out there) returned from a
ColdFusion server?

I have a "Service Browser" program running, during execution of my Flex
App, and I am getting a valid Remoting Result back from the server.
It's basically an Array of Objects, with each Object containing
RecordSet Data.

Thanks in advance for any advice you can throw my way.

Mike


--
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.394 / Virus Database: 268.10.4/399 - Release Date: 7/25/2006


--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.394 / Virus Database: 268.10.4/399 - Release Date: 7/25/2006


--
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.394 / Virus Database: 268.10.4/399 - Release Date: 7/25/2006

__._,_.___

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com





SPONSORED LINKS
Web site design development Computer software development Software design and development
Macromedia flex Software development best practice


YAHOO! GROUPS LINKS




__,_._,___

--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.394 / Virus Database: 268.10.4/399 - Release Date: 7/25/2006

Reply via email to