Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Duplicate selected values after multiple re-setting choices #751

Open
YuriGor opened this issue Nov 10, 2019 · 5 comments · May be fixed by #787
Open

Duplicate selected values after multiple re-setting choices #751

YuriGor opened this issue Nov 10, 2019 · 5 comments · May be fixed by #787
Labels

Comments

@YuriGor
Copy link

YuriGor commented Nov 10, 2019

Hi, thank you for the cool widget!
found a bug:
setChoices with replaceChoices = true and preselected choice in the data leads to nonsense duplicated value:

<select multiple></select>
const element = document.querySelector('select');
const choices = new Choices(element);

choices.setChoices([
  {label:'Choice 1', value:'1'},
  {label:'Choice 2', value:'2', selected:true},
  {label:'Choice 3', value:'3'},
], undefined, undefined, true);

choices.setChoices([
  {label:'Choice 1', value:'1'},
  {label:'Choice 2', value:'2', selected:true},
  {label:'Choice 3', value:'3'},
], undefined, undefined, true);

image
demo

@jshjohnson jshjohnson added the bug label Nov 12, 2019
@jshjohnson
Copy link
Collaborator

Hey - looks like the selected choice isn't being cleared. Thanks for raising

@YuriGor
Copy link
Author

YuriGor commented Nov 12, 2019

Yes, as a workaround i load data without selected attr and set selected items via API separately.

@Tim-arts
Copy link

When this issue will be fixed? It's quite an important bug

@viladimiru
Copy link

You can use .clearStore() as temporary solution

@nkb-bd
Copy link

nkb-bd commented May 23, 2022

Is this issue been resolved?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants