Skip to content

Commit 79c0d91

Browse files
committed
Accept arrays of options on addOption method.
1 parent 28da826 commit 79c0d91

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/selectize.js

+7
Original file line numberDiff line numberDiff line change
@@ -770,6 +770,13 @@ Selectize.prototype.refreshOptions = function(triggerDropdown) {
770770
* @param {object} data
771771
*/
772772
Selectize.prototype.addOption = function(value, data) {
773+
if ($.isArray(value)) {
774+
for (var i = 0, n = value.length; i < n; i++) {
775+
this.addOption(value[i][this.settings.valueField], value[i]);
776+
}
777+
return;
778+
}
779+
773780
if (this.options.hasOwnProperty(value)) return;
774781
value = String(value);
775782
this.userOptions[value] = true;

0 commit comments

Comments
 (0)