1
0
mirror of synced 2024-11-26 14:56:07 +03:00

Add internal support for sorting options

This commit is contained in:
Kevin Brown 2014-10-16 18:39:06 -04:00
parent 4f8fb28d93
commit 1aff36d28f
8 changed files with 34 additions and 4 deletions

View File

@ -166,6 +166,8 @@ define('select2/results',[
Results.prototype.append = function (data) { Results.prototype.append = function (data) {
var $options = []; var $options = [];
data = this.sort(data);
for (var d = 0; d < data.length; d++) { for (var d = 0; d < data.length; d++) {
var item = data[d]; var item = data[d];
@ -177,6 +179,10 @@ define('select2/results',[
this.$results.append($options); this.$results.append($options);
}; };
Results.prototype.sort = function (data) {
return data;
};
Results.prototype.setClasses = function () { Results.prototype.setClasses = function () {
var self = this; var self = this;

View File

@ -166,6 +166,8 @@ define('select2/results',[
Results.prototype.append = function (data) { Results.prototype.append = function (data) {
var $options = []; var $options = [];
data = this.sort(data);
for (var d = 0; d < data.length; d++) { for (var d = 0; d < data.length; d++) {
var item = data[d]; var item = data[d];
@ -177,6 +179,10 @@ define('select2/results',[
this.$results.append($options); this.$results.append($options);
}; };
Results.prototype.sort = function (data) {
return data;
};
Results.prototype.setClasses = function () { Results.prototype.setClasses = function () {
var self = this; var self = this;

View File

@ -9704,6 +9704,8 @@ define('select2/results',[
Results.prototype.append = function (data) { Results.prototype.append = function (data) {
var $options = []; var $options = [];
data = this.sort(data);
for (var d = 0; d < data.length; d++) { for (var d = 0; d < data.length; d++) {
var item = data[d]; var item = data[d];
@ -9715,6 +9717,10 @@ define('select2/results',[
this.$results.append($options); this.$results.append($options);
}; };
Results.prototype.sort = function (data) {
return data;
};
Results.prototype.setClasses = function () { Results.prototype.setClasses = function () {
var self = this; var self = this;

File diff suppressed because one or more lines are too long

6
dist/js/select2.js vendored
View File

@ -595,6 +595,8 @@ define('select2/results',[
Results.prototype.append = function (data) { Results.prototype.append = function (data) {
var $options = []; var $options = [];
data = this.sort(data);
for (var d = 0; d < data.length; d++) { for (var d = 0; d < data.length; d++) {
var item = data[d]; var item = data[d];
@ -606,6 +608,10 @@ define('select2/results',[
this.$results.append($options); this.$results.append($options);
}; };
Results.prototype.sort = function (data) {
return data;
};
Results.prototype.setClasses = function () { Results.prototype.setClasses = function () {
var self = this; var self = this;

File diff suppressed because one or more lines are too long

View File

@ -21,7 +21,7 @@ define([
// Check if the child object matches // Check if the child object matches
// The old matcher returned a boolean true or false // The old matcher returned a boolean true or false
var doesMatch = this.matcher(params.term, child.text); var doesMatch = this.matcher(params.term, child.text, child);
// If the child didn't match, pop it off // If the child didn't match, pop it off
if (!doesMatch) { if (!doesMatch) {
@ -38,7 +38,7 @@ define([
return match; return match;
} }
if (this.matcher(params.term, data.text)) { if (this.matcher(params.term, data.text, data)) {
return match; return match;
} }

View File

@ -27,6 +27,8 @@ define([
Results.prototype.append = function (data) { Results.prototype.append = function (data) {
var $options = []; var $options = [];
data = this.sort(data);
for (var d = 0; d < data.length; d++) { for (var d = 0; d < data.length; d++) {
var item = data[d]; var item = data[d];
@ -38,6 +40,10 @@ define([
this.$results.append($options); this.$results.append($options);
}; };
Results.prototype.sort = function (data) {
return data;
};
Results.prototype.setClasses = function () { Results.prototype.setClasses = function () {
var self = this; var self = this;