Topic: Multiselect with Option Groups

Adam Stapleton pro asked 6 years ago


I'm slightly confused as to why you have made the multiselect with optgroups behave differently to the standard one. Specifically in relation to the checkboxes on the items. The standard select contains a checkbox per row and the optgroup one doesn't. This provides a frustratingly different experience for my users when using dropdowns in the application! Is there a reason this one was created completely differently to the others?

Adam Stapleton pro answered 6 years ago


After some investigation into this, I have to say that I'm slightly disappointed by your initial response, I would go as far as to say that the query was answered with little/no knowledge of your own product.

As someone with very little JavaScript experience I managed to find a solution in a couple of hours. It eventually took changing only 2 lines of code to make the checkboxes appear for only the select options and not for the option groups.

For your information the required changes are:

Line 3028:

if (type === 'multiple' || type === 'optgroup-option') {

Line 30337:

if (type === 'multiple' || type === 'optgroup-option') {

Essentially you just treat an option group option as a multi select option and viola, problem solved.

Hopefully this is useful to someone else and maybe you can add it into the product at the next release cycle.


Mikołaj Smoleński staff commented 6 years ago

Thanks again for Your work Adam.

Mikołaj Smoleński staff answered 6 years ago


Hi Adam, The reason is that each option group is also an option, so the checkbox would appear for all select items. That's why we decided to remove checkboxes from selects with option groups. Regards

Adam Stapleton pro commented 6 years ago

That seems a strange decision to me. Would it not be just as easy to apply an additional class to the option groups within the select that hides the checkbox? A consistent user experience is one of the most valuable things from a developers point of view. Having different components of the same type act in different ways is a terrible solution.

Mikołaj Smoleński staff commented 6 years ago

I will add Your remarks to our list of ideas and features. We'll discuss Your issue and try to improve the multiselect in one of the future releases. Regards

Adam Stapleton pro commented 6 years ago

Another solution to this would be to show the checkbox next to an option group name and just have clicking that option select all/none of the options within that option group. (That would probably be a useful feature for many of your customers).

Mikołaj Smoleński staff commented 6 years ago

Thanks for Your remarks


Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Resolved

Specification of the issue

  • ForumUser: Pro
  • Premium support: No
  • Technology: MDB jQuery
  • MDB Version: -
  • Device: -
  • Browser: -
  • OS: -
  • Provided sample code: No
  • Provided link: No
Tags