Select2 multiselect - How to stop initial display sorting?

Select2 multiselect - How to stop initial display sorting?

HisanoriHisanori Posts: 1Questions: 1Answers: 0

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

Answers

  • allanallan Posts: 53,561Questions: 1Answers: 8,303 Site admin

    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

  • mguinnessmguinness Posts: 56Questions: 9Answers: 0

    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 are 3,2,1 it wouldn't display selections in that order.

Sign In or Register to comment.