default initSelection in tags mode instead of overriding it. fixes #811
This commit is contained in:
parent
d1e9531a0a
commit
270d4bad07
22
select2.js
22
select2.js
@ -789,17 +789,19 @@ the specific language governing permissions and limitations under the Apache Lic
|
|||||||
if (opts.createSearchChoice === undefined) {
|
if (opts.createSearchChoice === undefined) {
|
||||||
opts.createSearchChoice = function (term) { return {id: term, text: term}; };
|
opts.createSearchChoice = function (term) { return {id: term, text: term}; };
|
||||||
}
|
}
|
||||||
opts.initSelection = function (element, callback) {
|
if (opts.initSelection === undefined) {
|
||||||
var data = [];
|
opts.initSelection = function (element, callback) {
|
||||||
$(splitVal(element.val(), opts.separator)).each(function () {
|
var data = [];
|
||||||
var id = this, text = this, tags=opts.tags;
|
$(splitVal(element.val(), opts.separator)).each(function () {
|
||||||
if ($.isFunction(tags)) tags=tags();
|
var id = this, text = this, tags=opts.tags;
|
||||||
$(tags).each(function() { if (equal(this.id, id)) { text = this.text; return false; } });
|
if ($.isFunction(tags)) tags=tags();
|
||||||
data.push({id: id, text: text});
|
$(tags).each(function() { if (equal(this.id, id)) { text = this.text; return false; } });
|
||||||
});
|
data.push({id: id, text: text});
|
||||||
|
});
|
||||||
|
|
||||||
callback(data);
|
callback(data);
|
||||||
};
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user