views:

305

answers:

1

I have a combobox with a custom itemRenderer. The ItemRenderer displays some images and a label. When the combobox opens, the items in the dropdown list display perfectly, but when its closed, the combobox doesn't use the ItemRendere, but shows "[object MyItem]". Do I need another attribute to indicate that the ItemRender also needs to be used when closed?

This is my tag:

<mx:ComboBox dataProvider="{myItems}" id="itemsCombo" itemRenderer="org.test.myComboBoxItemRenderer" />
+2  A: 

you need to set the labelField or labelFunction property on the combobox to show the same thing as your itemrenderer.

Gregor Kiddie
That will suffice to show a text label, but if the itemrenderer is more complex (e.g. images, etc) you'll want to take a look at this earlier answer: http://stackoverflow.com/questions/269773/flex-custom-item-renderer-for-the-displayed-item-in-the-combobox/280859#280859
Rhysyngsun