Hi,
First problem I see with this code (... label="Add" click="{addRow()}
..") is tha in the click event I don;t think you need the {}. You can
put AS code there.
Second what happens is probably that CF adapter returns the array of
objects with properties in upper case, so .DATA and .LABEL. The combo
box looks for them in lower case.
If you are using beta 2 cf adapter (i don;t know if this works in beta
1 aswell) you can set some properties to convert the return objects
fomr CF to lowercase. Look for the <property-case> section in your
flex-enterprise-services.xml file.
Another option (i used this before finding the case settings) is to
"fix" the case in the return result object. Something like:
public function fixCase(types: ArrayCollection):ArrayCollection {
var newTypes:ArrayCollection = new ArrayCollection();
for (var i:int; i < types.length;i++) {
newTypes.addItem(
{data:types.getItemAt(i).DATA,
label:types.getItemAt(i).LABEL}
); }
return newTypes;
}
Cristian
--- In [email protected], "rgwilson26" <[EMAIL PROTECTED]> wrote:
>
> I tried using both cmbDept.selectedItem.data or
> cmbDept.selectedItem.label, but it displays nothing inside the
> datagrid. With cmbDept.selectedItem it displays [object Object] for
> each click event.
>
> --- In [email protected], "Anatole Tartakovsky"
> <anatolet@> wrote:
> >
> > And you are looking for
> > cmbDept.selectedItem.data or cmbDept.selectedItem.label?
> >
> >
> > ----- Original Message -----
> > From: rgwilson26
> > To: [email protected]
> > Sent: Wednesday, March 29, 2006 10:15 AM
> > 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" <tspratt@>
> 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
> >
> > a.. Visit your group "flexcoders" on the web.
> >
> > b.. To unsubscribe from this group, send an email to:
> > [EMAIL PROTECTED]
> >
> > c.. Your use of Yahoo! Groups is subject to the Yahoo! Terms
> of Service.
> >
> >
> > --------------------------------------------------------------------
> ----------
> >
>
--
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/