Bind the datagrid's dataProvider to the .lastResult of webservice operation
<mx:DataGrid dataProvider="{myService.getData.lastResult}">
<mx:columns>
<mx:DataGridColumn headerText="HeaderName 1" dataField="nameOfDataField1" />
<mx:DataGridColumn headerText="HeaderName 2" dataField="nameOfDataField2" />
</mx:columns>
</mx:DataGrid>
ObjectUtil.toString() is kinda like cfdump.
trace(mx.utils.ObjectUtil.toString({id:1, msg:"Hello World"}));
To see trace() output you need to run the application in debug mode.
You can select that from the "Run" menu:
Run --> Debug [name_of_application]
You'll see the output in the IDE Console panel.
regards,
Muzak
----- Original Message -----
From: "captnjay_mobile" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Thursday, March 08, 2007 4:05 PM
Subject: [flexcoders] Re: exposing CFC's as web services
How do I then reference that array in my data grid on the UI side?
Also how can I debug the results.. sort of like a CFDUMP in coldfusion?
--- In [email protected], "Muzak" <[EMAIL PROTECTED]> wrote:
>
> Do a trace in the result handler, using mx.utils.ObjectUtil
>
> public function handleQueryResult(event:ResultEvent):void{
> trace(mx.utils.ObjectUtil.toString(event.result));
> }
>
> run in debug mode.
>
> If I had to guess:
> You're probably returning a cfquery from a DB.
> If so, when accessing a cfc as WebService, query row field names are
returned in Uppercase.
>
> Don't return cfquery's, but Array of Objects (structs) from cfc's.
>
> Loop through the query and assign each field to a Struct and store
each Struct in an Array.
> When setting each field, use Array access notation (see below):
>
> <cfset tmpObj["fieldNameWithMixedCase"] = fieldNameWithMixedCase />
>
> It's a pain, but will hopefully get fixed in the next CF release.
>
> regards,
> Muzak
>
> ----- Original Message -----
> From: <[EMAIL PROTECTED]>
> To: <[email protected]>
> Sent: Wednesday, March 07, 2007 1:50 AM
> Subject: [flexcoders] exposing CFC's as web services
>
>
> > I'm new to flex development and I'm just trying to do a simple
data pull from a cfc using a web service.
> >
> > Query Result Function..
> > public function handleQueryResult(event:ResultEvent):void{
> > qResult=event.result as ArrayCollection;
> > }
> >
> > Web Service..
> > <mx:WebService id="myService"
wsdl="http://localhost/HelloWorld.cfc?WSDL" useProxy="false">
> > <mx:operation name="getData" result="handleQueryResult(event);"
fault="Alert.show(event.fault.message)">
> > </mx:operation>
> > </mx:WebService>
> >
> > Data Grid..
> > <mx:DataGrid dataProvider="{qResult}" width="668" height="376"
x="20" y="240">
> >
> > Button...
> > <mx:Button label="get projects" click="myService.getProjects()"
x="377" y="199"/>
> >
> >
> > I can get this to work fine if I use mx:RemoteObject...
> > <mx:RemoteObject
> > id="myService"
> > destination="ColdFusion"
> > source="CFC.HelloWorld"
> > showBusyCursor="true"
> > >
> >
> > But I'm using MX 6 so I need to use a webservice(right?)
> >
> > Anyhow.. any help w/ this would be appreciated.
> >
> > Thanks!
> > -Jason
> >
>