Here's what works for me.  Give these steps a try and post back if 
you still run into problems.

1. Define an <mx:operation> tag for your webservice and include a 
result handler function:

<mx:WebService id="srv" useProxy="false" 
wsdl="http://flex.homesmartagent.com/cfc/adminHS2F.cfc?wsdl"; 
showBusyCursor="true">
    <mx:operation name="agentDisplayQry" result="handleResults
(event)">
        <mx:request>
            <fileNum>0</fileNum>
        </mx:request>
    </mx:operation>
</mx:WebService>

2. Define the result handler function:

function handleResults(event: mx.rpc.events.ResultEvent) : void {
    // myArray defined elsewhere in script
    // you may also need to use mx.utils.ArrayUtil.toArray
(event.result) here as you would in Flex 1.5
    myArray = event.result;
}

3. Bind your dg dataprovider to the myArray variable (defined 
somewhere in script as something suitable for a dataProvider) 
instead of a property of the webservice:

<mx:DataGrid dataProvider="{myArray}" ...>

At the very least, this should allow you to verify that your 
webservice is returning a result in the format you expect. If not, 
add some trace statments in the result handler to see if you can 
determine where things are going wrong.

Hope this gets you closer to your objective!

Doug


--- In [email protected], "Jeremy Rottman" <[EMAIL PROTECTED]> 
wrote:
>
> I have been working on my cfc for a bit of time now, and I think 
that I
> certain parts of if finished. I am now working on getting my flex 
app
> connected to my cfc.
> 
> The place where I am stuck is displaying returned results in my
> datagrid.
> 
> Here I have my function called agentDisplayQry. I am taking three 
lists
> in my database, and converting them to arrays. I know this works 
because
> I can cfdump the array out and it displays exactly as I want it to.
> You can test it here http://flex.homesmartagent.com/test.cfm
> <http://flex.homesmartagent.com/test.cfm>
> 
>      <cffunction name="agentDisplayQry" access="remote"
> returntype="array"  output="false">
>          <cfargument name="fileNum" required="no" type="string"/>
>              <cfquery name="GetAgentList" 
datasource="#application.dsn#">
>                  select fld_agentList, fld_agentType, fld_agentSide
>                  from tbl_smartPanel_propInfo_Sale
>                  where fld_fileNum = '#arguments.fileNum#'
>              </cfquery>
> 
>              <cfset agentArray = arrayNew(1)>
>                  <cfloop from="1"
> to="#ListLen(GetAgentList.fld_agentList)#" index="NDX">
>                      <cfset agentArray[ndx] = structNew()>
>                      <cfset agentId =
> ListGetAt(GetAgentList.fld_agentList,NDX)>
>                          <cfquery name="agentQuery"
> datasource="#application.dsn#">
>                              select fld_fullname
>                              from tbl_smartPanel_userList
>                              where fld_userlogin = '#agentId#'
>                          </cfquery>
>                       <cfset agentArray[ndx].agentName =
> agentQuery.fld_fullname>
>                       <cfset agentArray[ndx].agentSide =
> ListGetAt(GetAgentList.fld_agentSide,NDX)>
>                       <cfset agentArray[ndx].agentType =
> ListGetAt(GetAgentList.fld_agentType,NDX)>
>                  </cfloop>
> 
>          <cfreturn agentArray />
>      </cffunction>
> 
> Now I am trying to return this data into a datagrid so that I can
> display it in order. On a Record Per Line basis. I am connecting 
to this
> fucntion via webservice. It is a pretty simple webservice as you 
can see
> below.
> 
> <mx:WebService id="srv" useProxy="false"
> wsdl="http://flex.homesmartagent.com/cfc/adminHS2F.cfc?wsdl";
> showBusyCursor="true" />
> 
> Here is my datagrid that I am trying to populate. I know that using
> click event is bad jojoo coding wise, but it is just there for 
testing.
> 
>                      <mx:DataGrid x="18" y="291" width="695"
> click="agentDisplayQry(fileNum.text)"
>                          
dataProvider="{srv.agentDisplayQry.result}"
> height="192" id="datagrid1">
>                          <mx:columns>
>                              <mx:DataGridColumn headerText="Agent 
Name"
> width="275"  columnName="AGENTNAME"/>
>                              <mx:DataGridColumn 
headerText="Transaction
> Side" width="150"  columnName="agentSide"/>
>                              <mx:DataGridColumn editable="true"
> headerText="% of Side" width="95"  columnName="col3"/>
>                              <mx:DataGridColumn headerText="Type"
> width="175" columnName="agentType"/>
>                          </mx:columns>
>                      </mx:DataGrid>
> 
> Here is my method I am using to connect the click event with my 
cfc.
> 
>                  // Agent Display function
>                  private function agentDisplayQry( fileNum ){
>              srv.agentDisplayQry ( fileNum );}
> 
> 
> So my over all question is, what am I doing wrong here. In terms 
that I
> am unable to populate this datagrid with the information returned 
as an
> array.
>







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

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to