Select2 multiselect - How to stop initial display sorting?
Select2 multiselect - How to stop initial display sorting?
select2 sorts server responses.
How can I stop the sorting?
Sorting on selection is solved by the following method and no problem.
https://datatables.net/forums/discussion/33219/select2-multiple-select-options-order
This question has accepted answers - jump to:
This discussion has been closed.
Answers
Hi,
You'd be best asking in the Select2 support channels if this is a select issue. That said, I'm surprised by that - I though it just displayed the data in the order you gave it. Perhaps you can link to the page so I can confirm what is going on?
Allan
I don't think they're talking about the order of the options in the list, but rather the order of selected items as described In multi-select, selections do not appear in the order in which they were selected.
If OP is talking about the ordering of selected items on control initialization that could be tricky. For example if you have select options
{ "Blue": 1, "Green": 2, "Red": 3 }
but the selected values from DB are3,2,1
it wouldn't display selections in that order.Hi,
Thanks for the reply.
I'll ask the question on the select2 site.
I am developing in a local environment, so I cannot paste my site.
I will paste the URL when the server is ready.
Thank you for your advice.
I will wait for the following pull request to be resolved and closed.
Add SelectionOrder DataAdapter decorator and related options
Thank you.
I sorted the DOM by referring to the raw data.
It was solved.
Thank you.
Nice one - thanks for posting you solution .
Allan