Add the ability to specify custom tags separator.
Signed-off-by: Igor Vaynberg <igor.vaynberg@gmail.com>
This commit is contained in:
parent
4489ab7769
commit
5aae33d789
@ -534,6 +534,9 @@
|
||||
this.select = select = opts.element;
|
||||
}
|
||||
|
||||
//Custom tags separator.
|
||||
opts.tagSeparator = opts.tagSeparator || ",";
|
||||
|
||||
if (select) {
|
||||
// these options are not allowed when attached to a select because they are picked up off the element itself
|
||||
$.each(["id", "multiple", "ajax", "query", "createSearchChoice", "initSelection", "data", "tags"], function () {
|
||||
@ -663,7 +666,7 @@
|
||||
opts.createSearchChoice = function (term) { return {id: term, text: term}; };
|
||||
opts.initSelection = function (element, callback) {
|
||||
var data = [];
|
||||
$(splitVal(element.val(), ",")).each(function () {
|
||||
$(splitVal(element.val(), opts.tagSeparator)).each(function () {
|
||||
data.push({id: this, text: this});
|
||||
});
|
||||
|
||||
@ -1827,7 +1830,7 @@
|
||||
return val === null ? [] : val;
|
||||
} else {
|
||||
val = this.opts.element.val();
|
||||
return splitVal(val, ",");
|
||||
return splitVal(val, this.opts.tagSeparator);
|
||||
}
|
||||
},
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user