0
votes

Ok what I want is quite typical, I am sure alot of Flex developers want it at some point in their life too. Let's take an example:

In user profile page, there is a combobox/dropdownlist for "current employer" which should have an item named "No employer" along side with other real employers like "IBM", "Apple",... We all can imagine that IBM, Apple are from the DB/server side, "No employer" is not, just a label for null-employee. So if "No employer" is selected, the combobox/dropdownlist will return null as selected item.

I googled many times since last year. 100% people suggest to put a dummy item into the dataProvider. I did it and it is kinda good. But I am thinkg about an alternative that I prefer: putting a button (having label = "No employer") in the Combobox/dropdown list, when user clicks on that button then selectedIndex = -1 (i.e selectedItem = null too).

But I am lacking experience and skill to implement such a custom component like that. Please give me some hints or some online ressource to do it.

Thank you very much

1

1 Answers

1
votes

If you are using Flex 4.5 or above, you can utilize the property "prompt" for the dropdownlist. When no item is selected, the component would display the prompt. So in your case, when the user clicks on the "No employer" button, by setting the selectedIndex=-1, the drop down list should change the text specified in prompt property.