Reputation: 193
Bootstrap multi select with opt group is not working properly when there is only one option inside optgroup. When I check Option 3.1 (in my example) all the optgroups above it get selected.
Please refer the following JSFiddle Link for the example.
Moreover is it possible to give only option, if optgroup has one element inside it? Like this:
<option value="Option 3.1">Option 3.1</option>
instead of
<optgroup label="Group 3">
<option value="Option 3.1">Option 3.1</option>
</optgroup>
I am using Bootstrap Multiselect with collapsible opt groups.
Please help me in solving this issue.
Edit
Even if I select both the options in Group 2, Group 1 opt group also gets selected.
Upvotes: 0
Views: 1886
Reputation: 12085
To fix it you need just to make a little modification in bootstrap-multiselect.js.
change this:
n.prevAll('.multiselect-group').find('input').prop('checked', i);
to this:
n.prevAll('.multiselect-group:first').find('input').prop('checked', i);
As per user comment i'm posting solution link here for future user reference .
Problems with optgroups and filter
Upvotes: 1