How to sort results select2 tags alphabetically?

I would like to sort alphabetically (case insensitive), the tags choosen from a select2. I have used the sorter function to sort the tags to be selected but once selected they are not displayed alphabetically.

How to do this ? (I work with last 4.1.0-rc.0 select2 release).

        tags: true,
        multiple: true,
        allowClear: true,
        sorter: function(data) {
                return data.sort(function (a, b) {
                        var a1 = a.text.toLowerCase();
                        var b1 = b.text.toLowerCase();
                        if (a1 > b1) {
                            return 1;
                        if (a1 < b1) {
                            return -1;
                        return 0;


<select name="list" id="example1" style="width:500px;">
   <option>United States</option>

Have posted the question as well on

See the last jsfiddle with a proposed solution but that does not work at initialization.

Do not understand why.

Just add ‘BBBB’, then the order will be correct.
Otherwise ‘AAAA’ is at the end !

No news on this issue ?