Actually, in Flex 1.5 you can set the selectedItem with: cb.selectedItem = cb.dataProvider.getItemAt(someValidIndex);
Why you would *want* to do that is another matter, since it's easier and probably much more efficient to just set the selectedIndex property: cb.selectedIndex = someValidIndex; If the dept column in your data is a numeric index into your combobox fields, just use that and you won't need to loop through the data. --- In [email protected], "Tracy Spratt" <[EMAIL PROTECTED]> wrote: > > I don't know why it ever worked, but you can't SET the selectedItem for > a ComboBox. If you want to select an item you must use selectedIndex. > Yeah, that means you have to loop over the dataProvider array and match > the property. > > Tracy > > -----Original Message----- > From: [email protected] [mailto:[EMAIL PROTECTED] On > Behalf Of rgwilson26 > Sent: Thursday, April 06, 2006 9:50 AM > To: [email protected] > Subject: [flexcoders] combo box selectedItem not being fired > > I am working on an app where I have a combo box that populates a > datagrid column with the selected item from the combo box. This part > works fine, but I when the user clicks on the row I want the item to > be reflected back in the combo box. This worked when I manually > inserted the values as strings in the combo box array, but now I have > a dataprovider providing the results and when the user clicks on a > row no change in the cb is seen. > > Is this because the results in the cb are now objects insted of > strings? And, what do I need to chage in order for the change in the > cb to take place? > > Thanks, > > Here is an example: > > > </mx:Script> > var dp:Array; > > private function doResult(result:Array):Void { > dp = result; > } > > </mx: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:columns> > <mx:Array> > <mx:DataGridColumn headerText="Department" columnName="dept" /> > <mx:DataGridColumn headerText="Due Date" columnName="dueDate" > > </mx:Array> > </mx:columns> > </mx:DataGrid> > > > > <mx:ComboBox id="cmbDept" dataProvider="{dp}" > selectedItem="dgResources.selectedItem.dept" /> > > > > > > > -- > 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/

