Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Select2 control, allow the same value to be selected numerous times

I have a scenario where I'd like to display a list of selected items but the selected items should be able to have the same value selected twice. The select2 control doesn't allow the same item to be selected more than once.

Example:

Options: Wheel, Door
Results: Wheel, Wheel, Wheel, Wheel, Door, Door

I want to be able to select say 4 wheels and 2 doors. So a total of six items would be selected. The backend of my system will then determine how to save the six items. I really just like to use the select2 for the UI portion. I understand the native select html allows multiple selections but the same value can't be selected twice. I'm looking for a UI component to handle this. I could have two select2 controls one to select the item and then send the results to another textbox but looking to see if anyone has implemented this using the great select2 control.

like image 510
maguy Avatar asked Oct 21 '22 09:10

maguy


1 Answers

The issue was discussed on Github. Looks like the last comment (until now) says: select2 doesnt support duplicates. that is on the roadmap for 4.0.

UPDATE: It is now supported in Select2 v.4.0

like image 58
Didac Montero Avatar answered Oct 23 '22 01:10

Didac Montero