27 lines
809 B
JavaScript
27 lines
809 B
JavaScript
import { Controller } from 'stimulus'
|
|
import selectpicker from 'bootstrap-select'
|
|
import 'bootstrap-select/dist/css/bootstrap-select.css'
|
|
|
|
/*
|
|
* This is an example Stimulus controller!
|
|
*
|
|
* Any element with a data-controller="selectpicker" attribute will cause
|
|
* this controller to be executed. The name "selectpicker" comes from the filename:
|
|
* selectpicker_controller.js -> "selectpicker"
|
|
*
|
|
* Delete this file or adapt it for your use!
|
|
*/
|
|
export default class extends Controller {
|
|
connect() {
|
|
var placeholder = 'ничего не выбрано'
|
|
|
|
if (this.element.dataset.placeholder) {
|
|
placeholder = this.element.dataset.placeholder;
|
|
}
|
|
|
|
jQuery(this.element).selectpicker({
|
|
noneSelectedText : placeholder
|
|
});
|
|
}
|
|
}
|