slim-select icon indicating copy to clipboard operation
slim-select copied to clipboard

Feature Request: Selectable optgroup labels

Open c6p opened this issue 2 years ago • 3 comments

There is selectByGroup (unlike it, I don't need to select all items) option and #57. But, what I need is optgroups as selectable as items underneath. I have some specific action when an optgroup is selected.

I tried to set text and value attributes besides label and options on optgroups. Though, it doesn't seem to be working.

Is it possible to introduce a selectableGroup option?

c6p avatar Aug 11 '22 07:08 c6p

I also want this to be implemented!

Flexxkii avatar Aug 18 '22 08:08 Flexxkii

What would happen when you select the group?

brianvoe avatar Aug 18 '22 14:08 brianvoe

What would happen when you select the group?

That 'label' is not selectable.

Also, I want to say thank you so much for this library!

Flexxkii avatar Aug 18 '22 15:08 Flexxkii

I would also like this! For some context, my usecase is that I have a dropdown used to filter a list of locations, nested by country, state/province, with city/town being the final level of nesting. It's used to filter a list of locations. I want people to not only be able to filter by city, but also by country or state.

WesleyAC avatar Nov 01 '22 19:11 WesleyAC

Sorry i think this thread is a little all over the place. Currently you can select an optgroup and all the values in the optgroup will be selected so this feature is in there. @WesleyAC from what it sounds like you want slim select to output 2 value in which the label(country/state) as one of the values? I currently don't have any plans on making labels a selectable value. But what you can do is set your option to and that way when someone selects a state the value consists of that state as well as the country. If you wanted to get fancy and take it a step further you can use html and css to show that in the selected value. Hope that helps.

brianvoe avatar Nov 01 '22 20:11 brianvoe