Skip to content

Commit

Permalink
use stimulus values in select input component controller
Browse files Browse the repository at this point in the history
  • Loading branch information
Bilelkihal authored and syphax-bouazzouni committed Aug 6, 2023
1 parent 591e0db commit 3210837
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,16 @@ import { Controller } from "@hotwired/stimulus"
import TomSelect from "tom-select"

export default class extends Controller {
static values = {
multiple: Boolean,
openAdd : Boolean
}
connect() {
let myOptions = {}
if (this.data.get("multipleValue")) {
if (this.multipleValue) {
myOptions['plugins'] = ['remove_button'];
}
if (this.data.get("openAddValue")) {
if (this.openAddValue) {
myOptions['create'] = true;
}
new TomSelect(this.element, myOptions);
Expand Down

0 comments on commit 3210837

Please sign in to comment.