Sort multiselects alphabetically
This commit is contained in:
parent
5ff7704db4
commit
f0afd14ed3
|
@ -1689,6 +1689,20 @@ S2.define('select2/selection/multiple',[
|
|||
return;
|
||||
}
|
||||
|
||||
// Sort selected elements alphabetically by text.
|
||||
data.sort(function(a, b){
|
||||
atext = a.text.toLowerCase();
|
||||
btext = b.text.toLowerCase();
|
||||
|
||||
if (atext > btext) {
|
||||
return 1;
|
||||
}
|
||||
if (atext < btext) {
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
});
|
||||
|
||||
var $selections = [];
|
||||
|
||||
for (var d = 0; d < data.length; d++) {
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1689,6 +1689,20 @@ S2.define('select2/selection/multiple',[
|
|||
return;
|
||||
}
|
||||
|
||||
// Sort selected elements alphabetically by text.
|
||||
data.sort(function(a, b){
|
||||
atext = a.text.toLowerCase();
|
||||
btext = b.text.toLowerCase();
|
||||
|
||||
if (atext > btext) {
|
||||
return 1;
|
||||
}
|
||||
if (atext < btext) {
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
});
|
||||
|
||||
var $selections = [];
|
||||
|
||||
for (var d = 0; d < data.length; d++) {
|
||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue