Skip to content

Disabling an option in an optgroup doesn't work for a select2 initialised with a data array. #6392

Description

@jrchenery

Setting the disabled attribute on an option created from data that is not grouped disables the option in the select2 dropdown as expected.
If the data is grouped and the option is inside an optgroup the option is not shown as disabled in the select2.

Steps to reproduce:

  • Initialise a select2 using a data array which contains grouped data
  • Set the disabled html attribute on one of the options
  • Option is not disabled in the select2

I've created a fiddle which shows the difference in behaviour with ungrouped and grouped data: https://jsfiddle.net/tew29Lpd/
The Disable button should disable 'Option 2' in both selects but it does not in the one with optgroups.

Using version 4.0.13, in Chrome and Firefox

No activity

Activity on this issue will appear here.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions