Skip to content

Commit 42739b7

Browse files
author
Florian Kissling
committed
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 select2#3357 – the conflicting addition to docs/examples.html – has been ported to the appropiate partial in docs/_includes/examples.data.html.
2 parents 691dfe5 + bd6148e commit 42739b7

3 files changed

Lines changed: 12 additions & 6 deletions

File tree

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"description": "Select2 is a jQuery based replacement for select boxes. It supports searching, remote data sets, and infinite scrolling of results.",
44
"main": [
55
"dist/js/select2.js",
6-
"dist/css/select2.css"
6+
"src/scss/core.scss"
77
],
88
"repository": {
99
"type": "git",

docs/_includes/examples/data.html

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,12 +96,18 @@ <h2 id="data-ajax" >Loading remote data</h2>
9696
page: params.page
9797
};
9898
},
99-
processResults: function (data, page) {
100-
// parse the results into the format expected by Select2.
99+
processResults: function (data, params) {
100+
// parse the results into the format expected by Select2
101101
// since we are using custom formatting functions we do not need to
102-
// alter the remote JSON data
102+
// alter the remote JSON data, except to indicate that infinite
103+
// scrolling can be used
104+
params.page = params.page || 1;
105+
103106
return {
104-
results: data.items
107+
results: data.items,
108+
pagination: {
109+
more: (params.page * 30) < data.total_count
110+
}
105111
};
106112
},
107113
cache: true

src/js/select2/data/ajax.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ define([
1010
this.processResults = this.ajaxOptions.processResults;
1111
}
1212

13-
ArrayAdapter.__super__.constructor.call(this, $element, options);
13+
AjaxAdapter.__super__.constructor.call(this, $element, options);
1414
}
1515

1616
Utils.Extend(AjaxAdapter, ArrayAdapter);

0 commit comments

Comments
 (0)