Closed pvictor closed 2 months ago
Describe the bug Order is not preserved in select.getSelected() when using keepOrder: true
select.getSelected()
keepOrder: true
Recreate it in Codepen Here's a codepen to test: https://codepen.io/pvictor-r/pen/LYKMQPV?editors=1111
To Reproduce
HTML:
<script src="https://unpkg.com/slim-select@latest/dist/slimselect.min.js"></script> <link href="https://unpkg.com/slim-select@latest/dist/slimselect.css" rel="stylesheet"> </link> <select id="selectElement" multiple> <option>Option 1</option> <option>Option 2</option> <option>Option 3</option> </select> <button id="button" type="button">Click Me!</button>
JS:
var select = new SlimSelect({ select: "#selectElement", settings: { keepOrder: true } }); var button = document.getElementById("button"); button.addEventListener("click", function () { var values = select.getSelected(); console.log(values); });
Result:
Am I missing something ? Thanks!
Nice find. I have a fix for it and will go out in the next release
Describe the bug Order is not preserved in
select.getSelected()
when usingkeepOrder: true
Recreate it in Codepen Here's a codepen to test: https://codepen.io/pvictor-r/pen/LYKMQPV?editors=1111
To Reproduce
HTML:
JS:
Result:
Am I missing something ? Thanks!