1
0
mirror of synced 2024-11-26 14:56:07 +03:00

Merge pull request #1690 from evangun/initSelectionFix

Edit the default initSelection function to pass all tag properties
This commit is contained in:
Igor Vaynberg 2013-09-06 08:48:29 -07:00
commit 49c8b6cf50

View File

@ -974,10 +974,11 @@ the specific language governing permissions and limitations under the Apache Lic
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 () {
var id = this, text = this, tags=opts.tags; var obj = { id: this, text: this },
tags = opts.tags;
if ($.isFunction(tags)) tags=tags(); if ($.isFunction(tags)) tags=tags();
$(tags).each(function() { if (equal(this.id, id)) { text = this.text; return false; } }); $(tags).each(function() { if (equal(this.id, obj.id)) { obj = this; return false; } });
data.push({id: id, text: text}); data.push(obj);
}); });
callback(data); callback(data);