Maybe Tracy can figure it out from just the renderer code, but I think I need a complete (but small) test case with some sample data.
The only thing I see that looks unusual (besides calling refrehs() is setting both selectedItem and selectedIndex. One should be good enough. On 2/6/10 8:34 PM, "Laurence" <[email protected]> wrote: --- In [email protected] <mailto:flexcoders%40yahoogroups.com> , "Tracy Spratt" <tr...@...> wrote: > > Refresh() is intended to re-apply a sort of filter to a collection. If it > is working in your case it is a side effect. Yeah, I figured as much. I noticed that if I opened then closed then re-opened the drop-down, the data would "sync" itself properly. Adding this refresh() statement was a way to force that to happen -- the user clicks on the combo box, the refresh happens (forcing the box closed), then the second click opens the drop-down with the proper data... Total hack-job, but it works. > > I couldn't find your previous post to look at the code, but I still suspect > recycling issues. For a combo box, you have to do two actions on set data > (actually in commitProperties, of course). You must re-assign to > dataProvider, and you must set the selectedIndex (you can only use > selectedItem if your items are simple strings or numbers). Are you doing > both of those things? Here's my code as it stands right now. Thanks for taking a look: <?xml version="1.0" encoding="utf-8"?> <mx:ComboBox xmlns:mx="http://www.adobe.com/2006/mxml" height="100%" width="100%" dataProvider="{listOfFees}" labelFunction="formatLabel" change="changeHandler(event)" openDuration="0" closeDuration="0"> <mx:Script> <![CDATA[ import mx.collections.ArrayCollection; import mx.utils.ObjectUtil; import mx.formatters.CurrencyFormatter; import mx.controls.DataGrid; import flash.events.Event; [Bindable]private var listOfFees:ArrayCollection; public override function set data(value:Object):void{ super.data = value; if (value == null) { listOfFees = null; } else { if (data.comp != "y") { listOfFees = new ArrayCollection([data.course_fee1]); if (data.course_fee2 != 0) { listOfFees.addItem(data.course_fee2); } if (data.course_fee3 != 0) { listOfFees.addItem(data.course_fee3); } if (data.course_fee4 != 0) { listOfFees.addItem(data.course_fee4); } if (data.course_fee5 != 0) { listOfFees.addItem(data.course_fee5); } } else { listOfFees = new ArrayCollection([0] as Array); } if (data.editable == "y") { this.enabled = true; } else { this.enabled = false; } this.selectedItem = data.fee_chosen; this.selectedIndex = data.fee_type - 1; } } private function formatLabel(item:Object):String { return currencyFormat.format(item); } override protected function focusInHandler(event:FocusEvent):void { listOfFees.refresh(); } public function changeHandler(event:Event):void { data.fee_chosen = this.selectedItem; data.fee_type = this.selectedIndex + 1; } ]]> </mx:Script> <mx:CurrencyFormatter id="currencyFormat" precision="2"/> </mx:ComboBox> -- Alex Harui Flex SDK Team Adobe System, Inc. http://blogs.adobe.com/aharui

