Allow for custom sorting functions
This adds the `sorter` function, which works in the same way as the old `sortResults` function.
This commit is contained in:
parent
ec1bd3387b
commit
caf4ad73d7
7
dist/js/select2.amd.full.js
vendored
7
dist/js/select2.amd.full.js
vendored
@ -236,7 +236,9 @@ define('select2/results',[
|
||||
};
|
||||
|
||||
Results.prototype.sort = function (data) {
|
||||
return data;
|
||||
var sorter = this.options.get('sorter');
|
||||
|
||||
return sorter(data);
|
||||
};
|
||||
|
||||
Results.prototype.setClasses = function () {
|
||||
@ -3268,6 +3270,9 @@ define('select2/defaults',[
|
||||
this.defaults = {
|
||||
language: EnglishTranslation,
|
||||
matcher: matcher,
|
||||
sorter: function (data) {
|
||||
return data;
|
||||
},
|
||||
minimumInputLength: 0,
|
||||
maximumInputLength: 0,
|
||||
theme: 'default',
|
||||
|
7
dist/js/select2.amd.js
vendored
7
dist/js/select2.amd.js
vendored
@ -236,7 +236,9 @@ define('select2/results',[
|
||||
};
|
||||
|
||||
Results.prototype.sort = function (data) {
|
||||
return data;
|
||||
var sorter = this.options.get('sorter');
|
||||
|
||||
return sorter(data);
|
||||
};
|
||||
|
||||
Results.prototype.setClasses = function () {
|
||||
@ -3268,6 +3270,9 @@ define('select2/defaults',[
|
||||
this.defaults = {
|
||||
language: EnglishTranslation,
|
||||
matcher: matcher,
|
||||
sorter: function (data) {
|
||||
return data;
|
||||
},
|
||||
minimumInputLength: 0,
|
||||
maximumInputLength: 0,
|
||||
theme: 'default',
|
||||
|
7
dist/js/select2.full.js
vendored
7
dist/js/select2.full.js
vendored
@ -9771,7 +9771,9 @@ define('select2/results',[
|
||||
};
|
||||
|
||||
Results.prototype.sort = function (data) {
|
||||
return data;
|
||||
var sorter = this.options.get('sorter');
|
||||
|
||||
return sorter(data);
|
||||
};
|
||||
|
||||
Results.prototype.setClasses = function () {
|
||||
@ -12803,6 +12805,9 @@ define('select2/defaults',[
|
||||
this.defaults = {
|
||||
language: EnglishTranslation,
|
||||
matcher: matcher,
|
||||
sorter: function (data) {
|
||||
return data;
|
||||
},
|
||||
minimumInputLength: 0,
|
||||
maximumInputLength: 0,
|
||||
theme: 'default',
|
||||
|
6
dist/js/select2.full.min.js
vendored
6
dist/js/select2.full.min.js
vendored
File diff suppressed because one or more lines are too long
7
dist/js/select2.js
vendored
7
dist/js/select2.js
vendored
@ -664,7 +664,9 @@ define('select2/results',[
|
||||
};
|
||||
|
||||
Results.prototype.sort = function (data) {
|
||||
return data;
|
||||
var sorter = this.options.get('sorter');
|
||||
|
||||
return sorter(data);
|
||||
};
|
||||
|
||||
Results.prototype.setClasses = function () {
|
||||
@ -3696,6 +3698,9 @@ define('select2/defaults',[
|
||||
this.defaults = {
|
||||
language: EnglishTranslation,
|
||||
matcher: matcher,
|
||||
sorter: function (data) {
|
||||
return data;
|
||||
},
|
||||
minimumInputLength: 0,
|
||||
maximumInputLength: 0,
|
||||
theme: 'default',
|
||||
|
4
dist/js/select2.min.js
vendored
4
dist/js/select2.min.js
vendored
File diff suppressed because one or more lines are too long
@ -502,7 +502,15 @@ $(".js-example-language").select2({
|
||||
|
||||
<pre data-fill-from=".js-code-theme"></pre>
|
||||
|
||||
<!-- Code is further down the page -->
|
||||
<script type="text/javascript" class="js-code-theme">
|
||||
$(".js-example-theme-single").select2({
|
||||
theme: "classic"
|
||||
});
|
||||
|
||||
$(".js-example-theme-multiple").select2({
|
||||
theme: "classic"
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
@ -698,13 +706,3 @@ $.fn.select2.amd.require(
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<script type="text/javascript" class="js-code-theme">
|
||||
$(".js-example-theme-single").select2({
|
||||
theme: "classic"
|
||||
});
|
||||
|
||||
$(".js-example-theme-multiple").select2({
|
||||
theme: "classic"
|
||||
});
|
||||
</script>
|
||||
|
3
src/js/select2/defaults.js
vendored
3
src/js/select2/defaults.js
vendored
@ -231,6 +231,9 @@ define([
|
||||
this.defaults = {
|
||||
language: EnglishTranslation,
|
||||
matcher: matcher,
|
||||
sorter: function (data) {
|
||||
return data;
|
||||
},
|
||||
minimumInputLength: 0,
|
||||
maximumInputLength: 0,
|
||||
theme: 'default',
|
||||
|
4
src/js/select2/results.js
vendored
4
src/js/select2/results.js
vendored
@ -78,7 +78,9 @@ define([
|
||||
};
|
||||
|
||||
Results.prototype.sort = function (data) {
|
||||
return data;
|
||||
var sorter = this.options.get('sorter');
|
||||
|
||||
return sorter(data);
|
||||
};
|
||||
|
||||
Results.prototype.setClasses = function () {
|
||||
|
Loading…
Reference in New Issue
Block a user