Take a look at Ben Forta's extended comboBox:
http://www.forta.com/blog/index.cfm/2006/11/22/Flex-ComboBox-With-selectedVa lue-Support Paul From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Josh McDonald Sent: Thursday, 9 October 2008 2:51 PM To: [email protected] Subject: Re: [flexcoders] Re: ComboBox in Component won't open to Saved Value Dan, what you're trying to do is a simple thing, but I think you're complicating it. Assuming you're using numbers or strings in your combobox and data, simply bind selectedItem="{ currentRecord.myValue }" If you're using something more complicated, say the dataprovider for the CB is an array of objects and the record data has an ID in it, put this in your popup: [Bindable] private var currentRecordOption : ComboOption; function set currentRecord(value : newRecord) : void { //Do whatever you normally do currentRecordOption = null; for each (var option : ComboOption in myValidOptions) { if (option.id == value.optionId) { currentRecordOption = option; break; } } } <ComboBox dataprovider="{myValidOptions}" selectedItem="{currentRecordOption}"/> Now, various parts of this can be optimised such as the searching, etc. But this *will* work. -Josh On Thu, Oct 9, 2008 at 1:19 PM, Dan Pride <[EMAIL PROTECTED]> wrote: My problem is there seems to be no way to kick the event to change the value. Here is the code, all of it. It can be seen in action at http://www.archaeolibrary.com/Gezer/Staff.html Note: I have view source enabled and all files should be represented. Creation complete works on the first time only. Select another staff member with a double click and the creation complete does not go. This is about as basic as data entry client server type programming (a very huge market possiblity here),... gets. This is not a flame. This is a valid point. This to me brings into question the entire language. I have spent months learning this stuff to start running into things so basic as this I wonder if I have been wise in my time investment. It tells me the creators are off on their own gig, and meeting simple data needs of clients like showing you what you picked the last time you were here, are not on their minds. That means this is probably not an isolated incidence. Is this really the product to use for data entry over the web? or should I be headed into Javascript and Ajax like everybody else. What else am I going to run into and how much of a pain is this going to be? Anyway here is the code, thank you for your time. A simple event to say "NEW DISPLAY DO IT AGAIN" just seems so damn basic. --- On Wed, 10/8/08, Tracy Spratt <[EMAIL PROTECTED]> wrote: > From: Tracy Spratt <[EMAIL PROTECTED]> > Subject: RE: [flexcoders] Re: ComboBox in Component won't open to Saved Value > To: [email protected] > Date: Wednesday, October 8, 2008, 9:22 PM > No, that should not work unless SDActionItem.platform is a > reference to > an item in the ComboBox dataProvider. > > > > Tracy > > > > > > > > ________________________________ > > From: [email protected] > [mailto:[EMAIL PROTECTED] On > Behalf Of valdhor > Sent: Wednesday, October 08, 2008 12:31 PM > To: [email protected] > Subject: [flexcoders] Re: ComboBox in Component won't > open to Saved > Value > > > > 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] > <mailto:flexcoders%40yahoogroups.com <mailto:flexcoders%2540yahoogroups.com> > > , "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/ > <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:flexcoders%40yahoogroups.com <mailto:flexcoders%2540yahoogroups.com> > > [mailto:[email protected] > <mailto:flexcoders%40yahoogroups.com <mailto:flexcoders%2540yahoogroups.com> > > ] On > > Behalf Of Dan Pride > > Sent: Wednesday, October 08, 2008 10:01 AM > > To: [email protected] > <mailto:flexcoders%40yahoogroups.com <mailto:flexcoders%2540yahoogroups.com> > > > 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 > > ------------------------------------ -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Alternative FAQ location: https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-1e62 079f6847 Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups Links http://groups.yahoo.com/group/flexcoders/ -- "Therefore, send not to know For whom the bell tolls. It tolls for thee." http://flex.joshmcdonald.info/ :: Josh 'G-Funk' McDonald :: 0437 221 380 :: [EMAIL PROTECTED]

