brianvoe / slim-select

Slim advanced select dropdown
http://slimselectjs.com
MIT License
1.03k stars 195 forks source link

maxValuesShown - just show all! #544

Closed andimg93 closed 4 months ago

andimg93 commented 4 months ago

As I see there is no possibility, as in the old SlimSelect, to just show all selections/values/badges. So we have the setting maxValuesShown which is by default set to 20. We could set it to e.g. 1000 and hope it is not reached but I would welcome more a possibility to set clearly what I want to achieve - show all.

Maybe there is already an option to do this? I mean not by doing something like:

const preSelectedOptions = document.querySelector('#multi-select').selectedOptions;
const slim = new SlimSelect({
                                select: '#multi-select',
                                multiple: true,
                                maxValuesShown: preSelectedOptions.length,
                                events: {
                                    afterChange: (info) => {
                                        slim.config.maxValuesShown = info.length;
                                    }
                                }
                            });

because also this is too much "work" to just show all selected values. I would appreciate a specific config key/setting like showAllEntries or just showAll (boolean) or just the possibility to transmit -1 to maxValuesShown to indicate unlimited.

brianvoe commented 4 months ago

Just set it high enough and it wont get hit. If you set it to 1000 and need to show all 1000 then you have a more fundamental ui issue you need to deal with.

andimg93 commented 4 months ago

Well, I tried to explain in my origin post that I would appreciate a clear value to set it „unlimited“. I give by myself the example with reacting to the selected choices by event triggering as well as the simple value which is so high that it should never be reached like 1000.

So again in brief -1 or a config value showAll as Boolean would be a more clear and clean solution - I think it’s just a thing of taste for me it feels not like a nice and clean solution to set it like the existing possibilities.

brianvoe commented 4 months ago

No thanks