Replies: 6 comments 2 replies
-
just found this discussion now as well since its something ive now come up against. doesnt seem to be a way to not have the select box grow and push all layouts out of wack currently. (i tried with css but no go). tom-select uses "templates" for rendering. but it uses an my suggestion @ the devs: remove the "item" render and turn it to "selected". pass a list of items to it as the first argument. if you keep the item render then just make the selected option's default pretty much just items.map item type thing. (this would keep backwards compatability) the idea is then in the callback function we can then add in something like
and voila. |
Beta Was this translation helpful? Give feedback.
-
Would be very interested in this feature. It's better for select limited in size and with long option names :) |
Beta Was this translation helpful? Give feedback.
-
This really should be added. Most other select libraries for react etc already have this. Kind of a no brainer. |
Beta Was this translation helpful? Give feedback.
-
I took @oyejorge's example and adjusted it a bit. Probably not the best way to handle it, but it works. It shows the name of the option if only one is selected. If more than one is selected then it shows n number of items. |
Beta Was this translation helpful? Give feedback.
-
in css .more::after { in js function itemmore(cb) { new TomSelect('#obj',{ |
Beta Was this translation helpful? Give feedback.
-
This is a great library that will help me remove jquery from a project entirely. I am using bootstrap-select at the moment in the project as it is currently bootstrap 4.
In bootstrap select there is an option to use a count variable so that in a multiple select rather than the list of items, the line "n items selected" is rendered.
As the select options are fairly long this is a great alternative to have. I have tried implemented this is the plugin system, and have had varied success using the render options to render a single item.
From my understanding what is needed is the ability the render the whole list, not just a single item. This way, a simple length can be performed to get the n value and render "n items selected".
This is probably much simpler than I am thinking too!
Edit: For my purposes this needs to be a dropdown style (with a readonly title), that is multiselect. For example, when the number of items selected is = 1 the title would be that value. When > 1 the readonly title would display "n items selected"
Beta Was this translation helpful? Give feedback.
All reactions