forked from snapappointments/bootstrap-select
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.html
320 lines (284 loc) · 10 KB
/
test.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
<!DOCTYPE html>
<html>
<head>
<title>Bootstrap-select test page</title>
<meta charset="utf-8">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.css">
<link rel="stylesheet" href="dist/css/bootstrap-select.css">
<style>
body {
padding-top: 70px;
}
</style>
<script src="https://code.jquery.com/jquery-3.2.1.slim.js" defer></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.js" defer></script>
<script src="dist/js/bootstrap-select.js" defer></script>
</head>
<body>
<nav class="navbar navbar-default navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header">
<a class="navbar-brand" href="#">Bootstrap-select usability tests</a>
</div>
</div>
</nav>
<div class="container">
<form class="form-horizontal" role="form">
<div class="form-group">
<label for="basic" class="col-lg-2 control-label">"Basic" (liveSearch disabled)</label>
<div class="col-lg-10">
<select id="basic" class="selectpicker show-tick form-control">
<option>cow</option>
<option data-subtext="option subtext">bull</option>
<option class="get-class" disabled>ox</option>
<optgroup label="test" data-subtext="optgroup subtext">
<option>ASD</option>
<option selected>Bla</option>
<option>Ble</option>
</optgroup>
</select>
</div>
</div>
</form>
<hr>
<form class="form-horizontal" role="form">
<div class="form-group">
<label for="basic" class="col-lg-2 control-label">"Basic" (liveSearch enabled)</label>
<div class="col-lg-10">
<select id="basic" class="selectpicker show-tick form-control" data-live-search="true">
<option>cow</option>
<option data-subtext="option subtext">bull</option>
<option class="get-class" disabled>ox</option>
<optgroup label="test" data-subtext="optgroup subtext">
<option>ASD</option>
<option selected>Bla</option>
<option>Ble</option>
</optgroup>
</select>
</div>
</div>
</form>
<hr>
<form class="form-horizontal" role="form">
<div class="form-group">
<label for="basic2" class="col-lg-2 control-label">"Basic" (multiple, maxOptions=1)</label>
<div class="col-lg-10">
<select id="basic2" class="show-tick form-control" multiple>
<option>cow</option>
<option>bull</option>
<option class="get-class" disabled>ox</option>
<optgroup label="test" data-subtext="another test">
<option>ASD</option>
<option selected>Bla</option>
<option>Ble</option>
</optgroup>
</select>
</div>
</div>
</form>
<hr>
<form class="form-horizontal" role="form">
<div class="form-group">
<label for="maxOption2" class="col-lg-2 control-label">multiple, show-menu-arrow, maxOptions=2</label>
<div class="col-lg-10">
<select id="maxOption2" class="selectpicker show-menu-arrow form-control" multiple data-max-options="2">
<option>chicken</option>
<option>turkey</option>
<option disabled>duck</option>
<option>goose</option>
</select>
</div>
</div>
</form>
<hr>
<form class="form-inline">
<div class="form-group">
<label class="col-md-1 control-label" for="lunch">Lunch:</label>
</div>
<div class="form-group">
<select id="lunch" class="selectpicker" data-live-search="true" title="Please select a lunch ...">
<option>Hot Dog, Fries and a Soda</option>
<option>Burger, Shake and a Smile</option>
<option>Sugar, Spice and all things nice</option>
<option>Baby Back Ribs</option>
<option>A really really long option made to illustrate an issue with the live search in an inline form</option>
</select>
</div>
</form>
<hr>
<form class="form-horizontal" role="form">
<div class="form-group form-group-lg">
<label for="error" class="col-lg-2 control-label">error</label>
<div class="col-lg-10 error">
<select id="error" class="selectpicker show-tick form-control">
<option>pen</option>
<option>pencil</option>
<option selected>brush</option>
</select>
</div>
</div>
</form>
<hr>
<form class="form-horizontal" role="form">
<div class="form-group has-error form-group-lg">
<label class="control-label col-lg-2" for="country">error type 2</label>
<div class="col-lg-10">
<select id="country" name="country" class="form-control selectpicker">
<option>Argentina</option>
<option>United State</option>
<option>Mexico</option>
</select>
<p class="help-block">No service available in the selected country</p>
</div>
</div>
</form>
<hr>
<nav class="navbar navbar-default" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="#">Navbar</a>
</div>
<form class="navbar-form navbar-left" role="search">
<div class="form-group">
<select class="selectpicker" multiple data-live-search="true" data-live-search-placeholder="Search" data-actions-box="true">
<optgroup label="filter1">
<option>option1</option>
<option>option2</option>
<option>option3</option>
<option>option4</option>
</optgroup>
<optgroup label="filter2">
<option>option1</option>
<option>option2</option>
<option>option3</option>
<option>option4</option>
</optgroup>
<optgroup label="filter3">
<option>option1</option>
<option>option2</option>
<option>option3</option>
<option>option4</option>
</optgroup>
</select>
</div>
<div class="input-group">
<input type="text" class="form-control" placeholder="Search" name="q">
<div class="input-group-btn">
<button class="btn btn-default" type="submit"><i class="glyphicon glyphicon-search"></i></button>
</div>
</div>
<button type="submit" class="btn btn-default">Search</button>
</form>
</div>
<!-- .container-fluid -->
</nav>
<hr>
<select id="first-disabled" class="selectpicker" data-hide-disabled="true" data-live-search="true">
<optgroup disabled="disabled" label="disabled">
<option>Hidden</option>
</optgroup>
<optgroup label="Fruit">
<option>Apple</option>
<option>Orange</option>
</optgroup>
<optgroup label="Vegetable">
<option>Corn</option>
<option>Carrot</option>
</optgroup>
</select>
<hr>
<select id="first-disabled2" class="selectpicker" multiple data-hide-disabled="true" data-size="5">
<option>Apple</option>
<option>Banana</option>
<option>Orange</option>
<option>Pineapple</option>
<option>Apple2</option>
<option>Banana2</option>
<option>Orange2</option>
<option>Pineapple2</option>
<option>Apple2</option>
<option>Banana2</option>
<option>Orange2</option>
<option>Pineapple2</option>
</select>
<button id="special" class="btn btn-default">Hide selected by disabling</button>
<button id="special2" class="btn btn-default">Reset</button>
<p>Just select 1st element, click button and check list again</p>
<hr>
<div class="input-group">
<span class="input-group-addon">@</span>
<select class="form-control selectpicker">
<option>One</option>
<option>Two</option>
<option>Three</option>
</select>
</div>
<hr>
<div class="input-group">
<span class="input-group-addon">@</span>
<select class="form-control selectpicker" data-mobile="true">
<option>One</option>
<option>Two</option>
<option>Three</option>
</select>
</div>
<p>With <code>data-mobile="true"</code> option.</p>
<hr>
<select id="done" class="selectpicker" multiple data-done-button="true">
<option>Apple</option>
<option>Banana</option>
<option>Orange</option>
<option>Pineapple</option>
<option>Apple2</option>
<option>Banana2</option>
<option>Orange2</option>
<option>Pineapple2</option>
<option>Apple2</option>
<option>Banana2</option>
<option>Orange2</option>
<option>Pineapple2</option>
</select>
<hr>
<div class="form-group">
<label for="tokens">Key words (data-tokens)</label>
<select id="tokens" class="selectpicker form-control" multiple data-live-search="true">
<option data-tokens="first">I actually am called "one"</option>
<option data-tokens="second">And me "two"</option>
<option data-tokens="last">I am "three"</option>
</select>
</div>
<hr>
<form class="form-inline">
<div class="form-group">
<label class="col-md-1 control-label" for="lunchBegins">Lunch (Begins search):</label>
</div>
<div class="form-group">
<select id="lunchBegins" class="selectpicker" data-live-search="true" data-live-search-style="begins" title="Please select a lunch ...">
<option>Hot Dog, Fries and a Soda</option>
<option>Burger, Shake and a Smile</option>
<option>Sugar, Spice and all things nice</option>
<option>Baby Back Ribs</option>
<option>A really really long option made to illustrate an issue with the live search in an inline form</option>
</select>
</div>
</form>
</div>
<script>
document.addEventListener('DOMContentLoaded', function () {
var mySelect = $('#first-disabled2');
$('#special').on('click', function () {
mySelect.find('option:selected').prop('disabled', true);
mySelect.selectpicker('refresh');
});
$('#special2').on('click', function () {
mySelect.find('option:disabled').prop('disabled', false);
mySelect.selectpicker('refresh');
});
$('#basic2').selectpicker({
liveSearch: true,
maxOptions: 1
});
});
</script>
</body>
</html>