diff --git a/app/webpacker/controllers/tom_select_controller.js b/app/webpacker/controllers/tom_select_controller.js index 93f10a50d3..e1b7a65dfb 100644 --- a/app/webpacker/controllers/tom_select_controller.js +++ b/app/webpacker/controllers/tom_select_controller.js @@ -2,15 +2,18 @@ import { Controller } from "stimulus" import TomSelect from "tom-select" export default class extends Controller { + static values = { options: Object } static defaults = { maxItems: 1, maxOptions: null, plugins: ["dropdown_input"], - allowEmptyOption: true, + allowEmptyOption: true } connect() { - this.control = new TomSelect(this.element, this.constructor.defaults) + this.control = new TomSelect( + this.element, { ...this.constructor.defaults, ...this.optionsValue } + ) } disconnect() {