Flex 3 ComboBox disabled options

Recently I had to make a drop down menu in a Flex Application, or either ComboBox in the Flex terminology, where some of the items in it should be disabled. Many tutorials explained how to make the entire ComboBox disabled, but that was out of scope here.The idea is to have a large range, let’s say the numbers from 1 to 30, and make 1 to 10 disabled, and the others – selectable. After reading the documentation of Adobe it appears that this is not possible with just using some attribute of the default component.

Of course in the case of only three you can make it with radio buttons or checkboxes. Here after the question how to write such a component, the answer is:

Have you considered using radio buttons rather than a combo box?

Well, no, I’m not! I’d like to make it for such a big range. In my case it was more than 200 options, the case with radio buttons is not enough.

Finally I found a sample of a disabled list items on http://joshblog.net but yet again it was dealing with list, not a combo box. In my case the combo box has very important built in events and fires different kind of them in any special situation. That’s why I don’t think this sample could do the work.

Actually as it seems easy and usefull, almost nowhere there was such a component. In Adobe’s blogs I found interesting post http://blogs.adobe.com/aharui/2007/06/disabling_list_selection.html where the author describes how to make a list with that properties, and somewhere in the comments I found the component at last:

Hi Alex,
I’m seeking the disabling combobox. Your posting give me some ideals.
And now, I have implmented the disabling ComboBox and List using my
method.
Your blog is very helpful for me.Thanks.

I have put my disabling ComboBox to my blog

Here it is http://wmcai.blog.163.com/blog/static/4802420088945053961/

Thanks to the author there is a demo and download. Soon I’ll share my experience with the disabled combo box items.

9 thoughts on “Flex 3 ComboBox disabled options

  1. Thanks so much. I was searching for such a long time for such component. Finally found it.

    Great blog keep going!

  2. thanks.. it is always nice to see people like u share there information , i am looking at ur blog now.. hope it alos helpfull

  3. great post, thanks for giving the background info for this non-hardcore programmer type starting out on flex

  4. Thanks for the helpful post.

    Sadly I need to use this component in a Flash project (that’s .fla not .mxml) and DataProvider gives me errors saying:

    Error #1069: Property enabled not found on fl.data.DataProvider and there is no default value.

    Am I missing something or can this just not work in regular ol’ Flash?

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>