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 

    
<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




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


YAHOO! GROUPS LINKS




Reply via email to