Wrong behavior when selecting same label items, but with different values
Opened this issue · 4 comments
Hello,
I encountered a strange/wrong behavior: when in source data there are two entries with same text (label), but different values, only one can be selected.
Example:
Data source is like this:
[{
"value": "123",
"label": "John Doe"
},
{
"value": "abc",
"label": "John Doe"
}]
If I select the first item (with allowSame set to false), I can't select the second one.
With allowSame set to true, I can select it, but I don't want to have duplicated entries values.
I checked the source and it seams (I'm not an expert!) the check in canAdd is only by text and not by value.
Thank you for the awesome project!
Best Regards!
i'm not sure what you mean by "i don't want to have duplicated entries values"
so you expect that you can have two "john does" in the menu and if you select one, select the other one, with a different value, will not add it to the list? if they have a distinct value, but a different label, they should be treated as unique tags no?
Sorry, my fault. I'll try to explain better.
I have a field where I can select multiple values, with option allowSame set to false.
Source is a json, with just label and value keys for each entry (like the example above).
What happens is, while I choose different entries with different labels, everything works fine.
But if I select the first John Doe (with value "123"), I can't select the second John Doe (with value "abc") and vice versa.
These entries have the same label, but different values and I should be able to select both (with allowSame = false)
The only way to select both, is to set allowSame to true, but I don't want user to be able to select the same entries, multiple times and have, for example, 3 John Doe with value 123.
Hope it's a more clearer explanation.
Thank you again!
oh i see that makes sense
i've made a change here
ddf9efb
you can give it a try on master
I confirm that now it works!
Thank you, you're awesome!