Tracy

I must be missing something here.

I have a combobox with a dataprovider of an arraycollection that is
returned from a MySQL database. This is populated on creationcomplete.
Once this arrayCollection is populated I make another call to get
specific data. Part of this data is a field that corresponds to an
item in the combobox.

When the second call returns, all I do is:

platformComboBox.selectedItem = SDActionItem.platform;

SDActionItem is the DTO returned from the second call and platform is
one of it's fields that correspond to an item in the combobox.

This works every time and I do not have to loop through the data provider.

Are you telling me that this should not work?


--- In [email protected], "Tracy Spratt" <[EMAIL PROTECTED]> wrote:
>
> ComboBox.selectedItem will only work if you assign a *reference to an
> item in the ComboBox dataProvider*.  This is rarely possible and is not
> in your case.
> 
>  
> 
> What you must do is loop over the items in the CobmoBox.dataProvider and
> compare the appropriate property's value to the value you want to match.
> When a match is found, use the loop indes to set the ComboBox's
> selectedIndex.  This is simple enough to do in a one-off situation.  
> 
>  
> 
> If you need this often, then you might want to use an extended ComboBox.
> Making a generic one is a bit tricky, because the Combo Box dataProvider
> items can have any properties at all.  I have an example on
> www.cflex.net <http://www.cflex.net/>  (it allows you to set the data
> field you want to match) and Ben forta has done one and there are
> others.
> 
>  
> 
> Tracy
> 
>  
> 
> ________________________________
> 
> From: [email protected] [mailto:[EMAIL PROTECTED] On
> Behalf Of Dan Pride
> Sent: Wednesday, October 08, 2008 10:01 AM
> To: [email protected]
> Subject: [flexcoders] ComboBox in Component won't open to Saved Value
> 
>  
> 
> Hi
> I have a ComboBox used as a Popup on a form component.
> It saves fine using the following function
> 
> private function closeGenderPop(event:Event):void {
> ComboBox(event.target).selectedItem.label}; 
> 
> 
> I want to have it display the stored value the next time it is opened.
> I tried this but no luck. 
> 
> private function openGenderPop(event:Event):void {
> genderPop.selectedIndex = 1; 
> ComboBox(event.target).selectedItem.label; }
> 
> Really appreciate the help
> 
> Dan Pride
>


Reply via email to