various small fixes. closes #99
This commit is contained in:
parent
94ffecb824
commit
d62bc5bef1
11
select2.js
11
select2.js
@ -70,7 +70,7 @@
|
||||
function indexOf(value, array) {
|
||||
var i = 0, l = array.length, v;
|
||||
|
||||
if (typeof value == 'undefined') {
|
||||
if (typeof value === "undefined") {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -244,7 +244,6 @@
|
||||
}
|
||||
// TODO 3.0 - replace query.page with query so users have access to term, page, etc.
|
||||
var results = options.results(data, query.page);
|
||||
self.context = results.context;
|
||||
query.callback(results);
|
||||
}
|
||||
});
|
||||
@ -678,8 +677,8 @@
|
||||
this.opts.query({
|
||||
term: this.search.val(),
|
||||
page: page,
|
||||
context: self.context,
|
||||
matcher: self.opts.matcher,
|
||||
context: this.context,
|
||||
matcher: this.opts.matcher,
|
||||
callback: this.bind(function (data) {
|
||||
var parts = [], self = this;
|
||||
$(data.results).each(function () {
|
||||
@ -740,6 +739,9 @@
|
||||
var parts = [], // html parts
|
||||
def; // default choice
|
||||
|
||||
// save context, if any
|
||||
this.context = (data.context===undefined) ? null : data.context;
|
||||
|
||||
// create a default choice and prepend it to the list
|
||||
if (this.opts.createSearchChoice && search.val() !== "") {
|
||||
def = this.opts.createSearchChoice.call(null, search.val(), data.results);
|
||||
@ -1478,7 +1480,6 @@
|
||||
val = (val === null) ? [] : val;
|
||||
this.setVal(val);
|
||||
// val is a list of objects
|
||||
st
|
||||
$(val).each(function () { data.push(self.id(this)); });
|
||||
this.setVal(data);
|
||||
this.updateSelection(val);
|
||||
|
Loading…
x
Reference in New Issue
Block a user