Choices
Choices copied to clipboard
Duplicate selected values after multiple re-setting choices
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);
Hey - looks like the selected choice isn't being cleared. Thanks for raising
Yes, as a workaround i load data without selected attr and set selected items via API separately.
When this issue will be fixed? It's quite an important bug
You can use .clearStore() as temporary solution
Is this issue been resolved?