wasikuss / select2-multi-checkboxes

Plugin to select2 (https://github.com/select2/select2) allowing multiple selection while retain old good dropdown.
MIT License
74 stars 52 forks source link

Use placeholder value when no items selected #38

Open damienmckenna opened 5 days ago

damienmckenna commented 5 days ago

The "placeholder" attribute seems a little useless as the "templateSelection" element is used as soon as the library loads.

It would be really useful if the placeholder could be used as the default when nothing is selected.

damienmckenna commented 3 days ago

FWIW I worked this out by modifying templateSelection() to check selected.length and if it's zero then load a placeholder value, otherwise use the normal string.