Select Control Adapter
Supports HTML select elements.
Registration
Basic OptionsFormElements and SelectFormElements are automatically created with the select type attribute.
This ensures that a select control adapter is initialized on the node.
By removing the data-bootstrapui-adapter-type attribute this can be prevented.
Retrieving the current value
Returns an array holding a single BootstrapUiControlValueHolder.
The context is the option element that defines the selected value.
The label holds the innerHTML of the selected option element.
The value is retrieved from the option element via jQuery#val.
// single selected value
[{
label: "One",
value: "1",
context: option#ca-select1
}]
// multi selected value
[{
label: "One",
value: "1",
context: option#ca-select1
},{
label: "Two",
value: "2",
context: option#ca-select2
}]
Selecting a value
Sets the value using jQuery#val.
// single value
adapter.selectValue( 1 );
// multi value, in case of a multi select
adapter.selectValue( [1, 2] );
Bootstrap Select
The bootstrap select control adapter is a variant of the select control adapter for bootstrap-select elements. It differs from the default select adapter behaviour for
- selecting a value
-
The value is set via the
selectpickerplugin. - triggering of events
-
-
bootstrapui.change: triggered when thechanged.bs.selectevent is triggered on the target element.
-
The adapter automatically registered on OptionsFormElements and SelectFormElements with the bootstrap-select type attribute.