For example, I have selected 1, 2, 3
。But now, I want to change the order to be 1,3,2
.
I did this as followings:
- delete the
2
and3
- and add
3
and2
But the result is still 1, 2, 3
.
How do I change to my wantted order?
For example, I have selected 1, 2, 3
。But now, I want to change the order to be 1,3,2
.
I did this as followings:
2
and 3
3
and 2
But the result is still 1, 2, 3
.
How do I change to my wantted order?
Select2 displays selected items in alphabetical order. As far as I know, the only way to change the order is to override the supplied SelectionAdapter.
There isn’t a lot of documentation about creating your own adapter, but since you just want to change the order in which the selected items are displayed, you can probably just modify the source code of the supplied SelectionAdapter. You can find that source code on the Select2 GitHub site.