harvesthq/chosen — pull request #1404 by pfiller (2013-07-25 18:17:56+00:00)
Title: Option to Hide Selected & Disabled Options

@harvesthq/chosen-developers

Back in [10.0](https://github.com/harvesthq/chosen/releases/tag/v0.10.0), we changed Chosen to show selected & disabled options in search results. This behavior change more closely matched the way real select boxes work and has, thus far, received very little complaint.

Unfortunately, this change has made it hard for Harvest to use the latest version of Chosen (oops). In large lists where the customer can filter the results based on some variables, we were using disabled to quickly toggle visibility of options. Often times in these scenarios, the list of disabled options can be longer than the available options -- which poses a real usability issue.

To accommodate this change I had to set up the `result_add_option` and `result_add_group` to short circuit when they shouldn't be displayed. I also changed group results so they only show up if they have an option that should be displayed. This prevents a situation where a group with all selected children shows up, but appears empty.

All in all, I think that offering a way to hide selected and disabled results is a useful option. Thoughts?