Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optgroups are not sorted #204

Open
ncelerier opened this issue Oct 23, 2020 · 2 comments
Open

Optgroups are not sorted #204

ncelerier opened this issue Oct 23, 2020 · 2 comments

Comments

@ncelerier
Copy link

Hello,

If you look at this example:
https://crlcu.github.io/multiselect/examples/optgroup.html

We have that:

<optgroup label="Swedish Cars">
      <option value="volvo">Volvo</option>
      <option value="saab">Saab</option>
</optgroup>
<optgroup label="German Cars">
      <option value="mercedes">Mercedes</option>
      <option value="audi">Audi</option>
</optgroup>

And when we look at the rendered multiselect, we have this ordering:

Swedish Cars
   Saab
German Cars
   Audi
   Mercedes

So:

  • the optgroups are NOT sorted
  • the options inside the optgroup are sorted

Is there a way to have the optgroup sorted, and the option sorted at the same time, like that:

German Cars
   Audi
   Mercedes
Swedish Cars
   Saab

Am I missing an option or something ?

Thank you for your help!

@crlcu
Copy link
Owner

crlcu commented Nov 30, 2020

Hi @ncelerier

You are right - the default behaviour of this plugin is not sorting optgroups - only options.
Anyway, I'm happy to accept pull requests from the community.

@ncelerier
Copy link
Author

Ok, thank you for clarifying.

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

No branches or pull requests

2 participants