multiselect-react-dropdown icon indicating copy to clipboard operation
multiselect-react-dropdown copied to clipboard

Not able to select the same option multiple times

Open melissaUMD opened this issue 4 years ago • 6 comments

I am trying to use this to select the same item more than once but it is preventing me from doing that.

melissaUMD avatar Feb 19 '20 20:02 melissaUMD

Please explain clearly.

  1. Single select or multi select?
  2. Scenario

srigar avatar Feb 20 '20 03:02 srigar

I have 2 students that have the same name and i do want to see both of their name in the option list. Please review and let me know.

melissaUMD avatar Feb 20 '20 04:02 melissaUMD

I am getting the same issue, is there any solutions to achieve this scenario?

raw-sanket avatar May 13 '20 13:05 raw-sanket

I found a small workaround: you need to add some zero-width space characters (ZWSP) "​" to each line displayed in the dropdown. Example:

let titles = items.map((item, index) => item.title + "​".repeat(index));

ZWSP does not affect the displayed text and at the same time adds uniqueness to it (because each string has it own ZWSP quantity in it).

pushnovn avatar Sep 11 '20 06:09 pushnovn

@srigar Any plan to support this? Otherwise, I might help with a PR.

jota12x avatar Aug 02 '21 12:08 jota12x

I found a small workaround: you need to add some zero-width space characters (ZWSP) "​" to each line displayed in the dropdown. Example:

let titles = items.map((item, index) => item.title + "​".repeat(index));

ZWSP does not affect the displayed text and at the same time adds uniqueness to it (because each string has it own ZWSP quantity in it).

I realised this approach leads to the values being selected and shown as chips but not checked within the options list. The reason is that the comparison for checkbox doesn't trim the zero-width space characters.

jota12x avatar Aug 16 '21 10:08 jota12x