Chad,

The code that I sent is just the listener/event handler for the 
results that are returned from the CFC.  I'm not using binding in my 
example.  I'm just assigning the results to the datagrid's 
dataProvider.

You need to add result="onListResult(event)" to your RemoteObject.

Try this, I've also added a fault handler:

<mx:Script>
<![CDATA[

import mx.controls.Alert;
import mx.rpc.events.ResultEvent;
import mx.rpc.events.FaultEvent;

private function onGetJobResult(re:ResultEvent):void {
   dgJob.dataProvider = ArrayCollection(re.result); 
}

private function onGetJobFault(fe:FaultEvent):void {
   Alert.show(fe.fault.message);
}

]]>
</mx:Script>

<mx:RemoteObject id="roJob" destination="ColdFusion" source="test" 
endpoint="http://demo.dev/flex2gateway/"; 
result="onGetJobResult(event)" 
fault="onGetJobFault(event)"> 
     <mx:method name="getJob">
         <mx:arguments>
             <jobNum>{jobNum.text}</jobNum>
         </mx:arguments>
     </mx:method>
</mx:RemoteObject>

<mx:DataGrid id="dgJob" x="10" y="274" width="356" >
        <mx:columns>
                <mx:DataGridColumn headerText="Job Number" 
dataField="JobNum"/>
                <mx:DataGridColumn headerText="Job Name" 
dataField="JobName"/>
                <mx:DataGridColumn headerText="Job Description" 
dataField="JobDescription"/>
        </mx:columns>
 </mx:DataGrid>


--- In flexcoders@yahoogroups.com, "Chad Gray" <[EMAIL PROTECTED]> wrote:
>
> Thanks Clint and Maury,
> 
> Im afraid it don't completely understand the lingo "bind the result 
to an array".
> 
> I get an error when I run the program 
> ReferenceError: Error #1065: Variable  is not defined.
> 
> I think my datagrid datafields are wrong or the function is not 
running.
> 
> So on the function code you sent here is what I think is happening 
and how I reformatted it for my code:
> protected function onListResult(roGetJob:ResultEvent):void {
>       dgJob.dataProvider = ArrayCollection(roGetJob.result); }
> 
> 
> Here is my romoteOject code:
> <mx:RemoteObject id="roGetJob" destination="ColdFusion" 
source="test" endpoint="http://demo.dev/flex2gateway/"; > 
>     <mx:method name="getJob">
>         <mx:arguments>
>             <jobNum>{jobNum.text}</jobNum>
>         </mx:arguments>
>     </mx:method>
> </mx:RemoteObject>
> 
> 
> Here is my data grid code:
> <mx:DataGrid id="dgJob" x="10" y="274" width="356" dataProvider="">
>       <mx:columns>
>               <mx:DataGridColumn headerText="Job Number" 
dataField="JobNum"/>
>               <mx:DataGridColumn headerText="Job Name" 
dataField="JobName"/>
>               <mx:DataGridColumn headerText="Job Description" 
dataField="JobDescription"/>
>       </mx:columns>
> </mx:DataGrid>
> 
> 
> Here is my cfc function
> <cffunction name="getJob" returnType="query" output="no" 
access="remote">
>       <cfargument name="jobNum" type="numeric" required="yes">
> 
>       <cfquery datasource="database" name="getJobInfo">
>       SELECT JobNum, JobName, JobDescription
>       FROM Job
>       WHERE JobNum = #arguments.jobNum#
>       </cfquery>
>                       
>       <cfreturn getJobInfo>
> </cffunction>
>


Reply via email to