stimulus-autocomplete icon indicating copy to clipboard operation
stimulus-autocomplete copied to clipboard

Multiselection

Open kstratis opened this issue 4 years ago • 7 comments

Hi,

Would you consider a multi-selection PR where a user selects multiple values from the dropdown;

kstratis avatar Feb 18 '21 12:02 kstratis

Interesting. So that would add multiple ids, as array, to hidden field?

pruzicka avatar Feb 18 '21 16:02 pruzicka

That is correct. Think about tagging for example; A user may wish to flag his post using one of the tags available in the database. Github does something similar with Labels I think.

So that would add multiple ids, as array, to hidden field?

That's the concept for now, yes. I still need to figure out how to style this thing but that's the idea. Each selected option should be removable and there should also be a master 'Cancel' button on the far right which would remove all selected options at once.

I think the groundwork is already done for this. What do you think?

kstratis avatar Feb 19 '21 09:02 kstratis

I like it. I don't use this controller right now in a way that I would utilize it right away but may be somebody would. Tagging is good example.

pruzicka avatar Feb 19 '21 10:02 pruzicka

hi, @kstratis, @pruzicka ! Any updates on it?

Senegal avatar Mar 21 '21 05:03 Senegal

hi, @kstratis, @pruzicka ! Any updates on it?

Not from me mate, I've said I like it.

pruzicka avatar Mar 21 '21 09:03 pruzicka

@Senegal I did some thinking over this and turns out it may not be as trivial as initially expected. I currently don't have the time to implement this let alone test and iterate. I'm leaving this open in case anybody else wants to pick it up.

FWIW I went with this library for now: https://github.com/snapappointments/bootstrap-select

UPDATE Another great option which I read about this week in javascript weekly seems to be tagify.

kstratis avatar Mar 25 '21 11:03 kstratis

I've started spiking this on the multiselection branch. I don't think the multiselection itself will be too difficult to implement, but we'll probably have to provide some styles with sensible defaults so it's easy to use.

afcapel avatar Feb 06 '22 17:02 afcapel