Group options
Enable group headers through the group property of the options or the optgroup of the native select.
Grouping works for both single and multiple select pickers.
Demo
Group headers with single select
html<label>
Single select
<input mbsc-input id="my-input" data-dropdown="true" />
</label>
<select id="single-group-select">
<optgroup label="US">
<option value="atl">Atlanta</option>
<option value="bos">Boston</option>
</optgroup>
<optgroup label="UK">
<option value="bat">Bath</option>
<option value="bri">Bristol</option>
</optgroup>
</select>
js$('#single-group-select').mobiscroll().select({
inputElement: document.getElementById('my-input'),
touchUi:
});
Render a group wheel
html<label>
Single select
<input mbsc-input id="my-input" data-dropdown="true" />
</label>
<select id="single-group-select">
<optgroup label="US">
<option value="atl">Atlanta</option>
<option value="bos">Boston</option>
</optgroup>
<optgroup label="UK">
<option value="bat">Bath</option>
<option value="bri">Bristol</option>
</optgroup>
<optgroup label="DE">
<option value="ber">Berlin</option>
<option value="dus">Duisburg</option>
<option value="col">Cologne</option>
</optgroup>
<optgroup label="FR">
<option value="par">Paris</option>
<option value="lyo">Lyon</option>
</optgroup>
</select>
js$('#single-group-select').mobiscroll().select({
showGroupWheel: true,
inputElement: document.getElementById('my-input'),
touchUi:
});
Group headers with multiple select
html<label>
Multi-select
<input mbsc-input id="my-input" data-dropdown="true" data-tags="true" />
</label>
<select id="multiple-group-select">
<optgroup label="Electronics">
<option value="1">Camera & Photo</option>
<option value="2">Cell Phones & Accessories</option>
<option value="3">GPS & Navigation</option>
</optgroup>
<optgroup label="Smart Home">
<option value="4">Plugs and Outlets</option>
<option value="5">Heating and Cooling</option>
<option value="6">Detectors and Sensors</option>
</optgroup>
</select>
js$('#multiple-group-select').mobiscroll().select({
inputElement: document.getElementById('my-input'),
touchUi:
});
JSHTML
mobiscroll.setOptions({
locale: ,
theme: ' ',
themeVariant: ' '
});
$(function () {
$('#demo-single-group-select')
.mobiscroll()
.select({
inputElement: document.getElementById('demo-single-group-select-input'),
});
$('#demo-single-group-select-wheel')
.mobiscroll()
.select({
showGroupWheel: true,
inputElement: document.getElementById('demo-single-group-select-wheel-input'),
});
$('#demo-multiple-group-select')
.mobiscroll()
.select({
inputElement: document.getElementById('demo-multiple-group-select-input'),
selectMultiple: true,
});
});
<label>
Single select
<input mbsc-input id="demo-single-group-select-input" placeholder="Please select..." data-dropdown="true" data-input-style="outline" data-label-style="stacked" />
</label>
<select id="demo-single-group-select">
<optgroup label="US">
<option value="1">Atlanta</option>
<option value="2">Boston</option>
</optgroup>
<optgroup label="UK">
<option value="3">Bath</option>
<option value="4">Bristol</option>
</optgroup>
</select>
<label>
Group wheel
<input mbsc-input id="demo-single-group-select-wheel-input" placeholder="Please select..." data-dropdown="true" data-input-style="outline" data-label-style="stacked" />
</label>
<select id="demo-single-group-select-wheel">
<optgroup label="US">
<option value="1">Atlanta</option>
<option value="2">Boston</option>
</optgroup>
<optgroup label="UK">
<option value="3">Bath</option>
<option value="4">Bristol</option>
</optgroup>
<optgroup label="DE">
<option value="ber">Berlin</option>
<option value="dus">Duisburg</option>
<option value="col">Cologne</option>
</optgroup>
<optgroup label="FR">
<option value="par">Paris</option>
<option value="lyo">Lyon</option>
</optgroup>
</select>
<label>
Multi-select
<input mbsc-input id="demo-multiple-group-select-input" placeholder="Please select..." data-dropdown="true" data-input-style="outline" data-label-style="stacked" data-tags="true" />
</label>
<select id="demo-multiple-group-select" multiple>
<optgroup label="Electronics">
<option value="1">Camera & Photo</option>
<option value="2">Cell Phones & Accessories</option>
<option value="3">GPS & Navigation</option>
</optgroup>
<optgroup label="Smart Home">
<option value="4">Plugs and Outlets</option>
<option value="5">Heating and Cooling</option>
<option value="6">Detectors and Sensors</option>
</optgroup>
</select>