groenroos / minimalect

Minimal select replacement for jQuery
350 stars 52 forks source link

Does not support disabling options #34

Closed FellowshipAgency closed 10 years ago

FellowshipAgency commented 11 years ago

The plugin does not allow options to be disabled, e.g.:

<select>
   <option value="a">A</option>
   <option value="b" disabled>B</option>
</select>

In the code above, the second option should not be possible to select.

groenroos commented 11 years ago

Sorry about that; will be fixed in 0.9.

For now, you can probably patch it by adding data-disabled="'+$el.prop("disabled")+'" to the HTML markup on line 250, and then

if(ch.data('disabled')) return false;

on line 396 to prevent disabled choices from being selected. This is untested code though, and not a complete solution, as it doesn't add a class to easily style disabled choices, and it doesn't prevent them from being shown when filtered. I hope it will suffice for now, though. :)

groenroos commented 10 years ago

In the next commit.