1
0
mirror of synced 2024-11-30 00:26:03 +03:00

better handling of tags that are not just strings. fixes #256

This commit is contained in:
Igor Vaynberg 2012-07-24 15:10:31 +03:00
parent 116528908a
commit f06aae38fb

View File

@ -672,7 +672,10 @@
opts.initSelection = function (element, callback) {
var data = [];
$(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);