import ApplicationController from './application_controller' export default class extends ApplicationController { connect() { super.connect() var default_opts = { plugins: ['restore_on_backspace', 'remove_button'], searchField: ['text', 'optgroup'], valueField: "id", allowEmptyOption: false, showEmptyOptionInDropdown: true, emptyOptionLabel: true, hideSelected: true, placeholder: "Please Select" } $(".default-selectize").selectize(default_opts) var $doctrine_content = $("#doctrineModal").find("input[name='content']") var $trix_content = $("#doctrineModal").find(".trix-content") var doctrine_content_suggestions_opts = { onChange: function (value) { if(value === null || value === undefined || value === "") { $doctrine_content.val("") $trix_content.val("") } else { $doctrine_content.val(value) $trix_content.val(value) } } }; $("#doctine_content_suggestions").selectize($.extend(doctrine_content_suggestions_opts, default_opts)) } }