When you do this:
dgResources.addItem( {dept: cmbDept.selectedItem} ); }

you are putting the whole combobox item object into the dept property of
a new object.

Perhaps you just want:
dgResources.addItem(cmbDept.selectedItem);

Tracy


-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of rgwilson26
Sent: Wednesday, March 29, 2006 10:16 AM
To: [email protected]
Subject: [flexcoders] Re: databinding issue for combobox

Basically I am calling a query that will populate a combobox. Then 
the user will be able to use a click event that will send that value 
from the combo box to a datagrid. Right now it sends a value from the 
combobox to the datagrid, but what is displayed is [object Object] 
instead of the desired value. 

Here is an example:

<SCRIPT>
public var dp:Array;

private function addRow():Void{
dgResources.addItem( {dept: cmbDept.selectedItem} );
}

private function doResult(result:Array):Void {
         dp = result;
     }

<SCRIPT>

<mx:RemoteObject id="ro" 
         endpoint="http://10.95.20.39:8500/flashservices/gateway";  
         source="cfdocs.components.getPersonnel">
<mx:method name="serviceDeptLOV" result="doResult
(event.result._items)"/>
                
</mx:RemoteObject>



<mx:DataGrid id="dgResources">
<mx:column>
<mx:Array>
<mx:DataGridColumn headerText="Department" columnName="dept" 
width="200"  />
</mx:Array>
</mx:columns>
</mx:DataGrid>

<mx:ComboBox id="cmbDept" dataProvider="{dp}"/>

<mx:Button label="Add" click="{addRow()}" textAlign="center"  
width="75"/>



******CFC Query********

<cffunction name="serviceDeptLOV" access="remote" returntype="query"> 
<cfquery name="getserviceDept" datasource="spotDB">
        SELECT ServiceDept
        FROM   dbo.ServiceDeptLOV
        ORDER BY ServiceDept
</cfquery>
                

<cfreturn getserviceDept>
</cffunction>


--- In [email protected], "Tracy Spratt" <[EMAIL PROTECTED]> wrote:
>
> [object Object] means you are trying to display a complex object as
> text.
> 
> Can you be more specific about what you mean when you say " send the
> results from the combobox to a datagrid "?
> 
> Tracy
> 
> -----Original Message-----
> From: [email protected] 
[mailto:[EMAIL PROTECTED] On
> Behalf Of rgwilson26
> Sent: Tuesday, March 28, 2006 2:41 PM
> To: [email protected]
> Subject: [flexcoders] databinding issue for combobox
> 
> I am working on an app where I am populating various combo boxes 
with 
> results from my look up tables in a sql server database. I have no 
> problem binding the results to the comboboxes dataProvider 
property. 
> However, when I try to send the results from the combobox to a 
datagrid 
> it populates the datagrid field with [object Object] instead of the 
> selected item value. 
> 
> I can call a query and populate a datagrid directly and it doesn't 
seem 
> to be an issue, so I am a little confused as to why it is a problem 
> going from a combobox to a datagrid?
> 
> Any suggestions?
> 
> 
> 
> 
> 
> 
> 
> --
> 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
>







--
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



 






--
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