better handling of tags that are not just strings. fixes #256
This commit is contained in:
parent
116528908a
commit
f06aae38fb
@ -672,7 +672,10 @@
|
|||||||
opts.initSelection = function (element, callback) {
|
opts.initSelection = function (element, callback) {
|
||||||
var data = [];
|
var data = [];
|
||||||
$(splitVal(element.val(), opts.separator)).each(function () {
|
$(splitVal(element.val(), opts.separator)).each(function () {
|
||||||
data.push({id: this, text: this});
|
var id = this, text = this, tags=opts.tags;
|
||||||
|
if ($.isFunction(tags)) tags=tags();
|
||||||
|
$(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