1
0
mirror of synced 2024-11-22 21:16:10 +03:00

Merge branch 'master' into docs-improvements

Conflicts:
	docs/examples.html

In the docs-improvements branch, the docs examples live in partials located in docs/_includes/examples.
The updated AJAX example code from https://github.com/select2/select2/pull/3357 – the conflicting addition to docs/examples.html – has been ported to the appropiate partial in docs/_includes/examples.data.html.
This commit is contained in:
Florian Kissling 2015-06-08 02:27:33 +02:00
commit 42739b780e
3 changed files with 12 additions and 6 deletions

View File

@ -3,7 +3,7 @@
"description": "Select2 is a jQuery based replacement for select boxes. It supports searching, remote data sets, and infinite scrolling of results.",
"main": [
"dist/js/select2.js",
"dist/css/select2.css"
"src/scss/core.scss"
],
"repository": {
"type": "git",

View File

@ -96,12 +96,18 @@ $(".js-data-example-ajax").select2({
page: params.page
};
},
processResults: function (data, page) {
// parse the results into the format expected by Select2.
processResults: function (data, params) {
// parse the results into the format expected by Select2
// since we are using custom formatting functions we do not need to
// alter the remote JSON data
// alter the remote JSON data, except to indicate that infinite
// scrolling can be used
params.page = params.page || 1;
return {
results: data.items
results: data.items,
pagination: {
more: (params.page * 30) < data.total_count
}
};
},
cache: true

View File

@ -10,7 +10,7 @@ define([
this.processResults = this.ajaxOptions.processResults;
}
ArrayAdapter.__super__.constructor.call(this, $element, options);
AjaxAdapter.__super__.constructor.call(this, $element, options);
}
Utils.Extend(AjaxAdapter, ArrayAdapter);