-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathtest.html
More file actions
291 lines (272 loc) · 9.3 KB
/
test.html
File metadata and controls
291 lines (272 loc) · 9.3 KB
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
<!DOCTYPE html>
<html>
<head>
<link href="https://netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.css" rel="stylesheet">
<link href="test.css" rel="stylesheet">
</head>
<body>
<span class="example">
<label for="select">
Select
</label>
<select data-uber-options='{"search":false}'>
<option>male</option>
<option>female</option>
</select>
</span>
<span class="example">
<label for="select">
Search and placeholder
</label>
<select placeholder="Choose a gender">
<option></option>
<option>male</option>
<option>female</option>
</select>
<p>This example includes a placeholder. Placeholders can be customized using the
<code>placholder</code> attribute, the <code>data-placeholder</code> attribute,
or the <code>placeholder</code> option.
</p>
</span>
<span class="example">
<label for="select">
Search input attributes
</label>
<select data-uber-options='{"searchInputAttributes": {"aria-label": "This is a test"}}'>
<option></option>
<option>male</option>
<option>female</option>
</select>
<p>This example includes an aria label attribute for the search input element.</p>
</span>
<span class="example">
<label for="select">
Prepopulate Search and Clear Select
</label>
<select placeholder="Choose a gender" data-uber-options='{"prepopulateSearchOnOpen":true, "clearSearchClearsSelect":true}'>
<option></option>
<option selected="selected">male</option>
<option>female</option>
</select>
<p>This example prepopulates the search with the value from the select, and
clears the select when the search is cleared.</p>
</span>
<span class="example">
<label for="select">
blank options hidden
</label>
<select placeholder="Choose a gender" data-uber-options='{"hideBlankOption":true, "prepopulateSearchOnOpen":true, "clearSearchClearsSelect":true}'>
<option></option>
<option selected="selected">male</option>
<option>female</option>
</select>
<p>This prepopulated example hides blank options, but still allows the search to be cleared</p>
</span>
<span class="example">
<label for="select">
Grouped search with group matching
</label>
<select data-uber-options='{"matchGroupNames": true}'>
<optgroup label="Colours">
<option>Red</option>
<option>Green</option>
</optgroup>
<optgroup label="Names">
<option>Red</option>
<option>Greene</option>
</optgroup>
</select>
<p>This example uses optgroups to separate option types. It allows the search to match against the group names, which
causes all results in that group to show.
</p>
</span>
<span class="example">
<label for="select">
Grouped search with visibility
</label>
<select>
<optgroup label="Common" data-visibility="no-query">
<option>cat</option>
<option>dog</option>
</optgroup>
<option>No group animal 1</option>
<option>No group animal 2</option>
<optgroup label="All">
<option>cat</option>
<option>dog</option>
<option>frog</option>
<option>monkey</option>
<option data-visibility="no-query">this option is not visible when querying</option>
<option data-visibility="query">this option is only visible when querying</option>
<option>goose</option>
<option>rabbit</option>
<option>rhino</option>
<option>elephant</option>
<option>bear</option>
<option>tiger</option>
<option>giraffe</option>
<option>goat</option>
<option>cow</option>
<option>pig</option>
<option>gorilla</option>
<option>orangutan</option>
<option>lemur</option>
</optgroup>
</select>
<p>This example uses optgroups to separate option types. Options and optgroups
may have a <code>data-visibility</code> attribute that determines when the option is available
for matching. A value of <code>no-query</code> means the option is only visible when the
user isn't performing a search. A value of <code>query</code> means the option
is only visible during a search. If an option doesn't specify this value, it
will inherit it from its optgroup.
</p>
</span>
<span class="example">
<label for="select">
Placeholder as blank
</label>
<select placeholder="males and females" data-uber-options='{"treatBlankOptionAsPlaceholder":true}'>
<option></option>
<option>male</option>
<option>female</option>
</select>
<p>This example uses the placeholder text as the text of the blank option.</p>
</span>
<span class="example">
<label for="select">
Minimum query length
</label>
<select placeholder="Type a character" data-uber-options='{"minQueryLength":1}'>
<option></option>
<option>Jimmy Johnson</option>
<option>Amanda Hugginkiss</option>
<option>Cosmo Kramer</option>
<option>Bob Zickowski</option>
<option>Nicholas Cage</option>
<option>Queen Latifah</option>
</select>
<p>This example uses <code>minQueryLength</code> to prevent short queries from updating results.</p>
</span>
<span class="example">
<label for="select">
Custom Search Placeholder
</label>
<select data-uber-options='{"searchPlaceholder":"Custom placeholder"}'>
<option></option>
<option>male</option>
<option>female</option>
</select>
<p>This example uses custom search input placeholder. Search input placeholders
can be set using the <code>searchPlaceholder</code> option.</p>
</span>
<span class="example">
<label for="select">
Custom No Results Message
</label>
<select data-uber-options='{"noResultsText":"Custom message"}'>
<option></option>
<option>male</option>
<option>female</option>
</select>
<p>This example uses customizes the text displayed when no results are found.
This this can be set using the <code>noResultsText</code> option.</p>
</span>
<span class="example">
<label for="select">
Remote JSON Dataset
</label>
<select data-uber-options='{"dataUrl":"data:text/plain;charset=utf-8;base64,W3sidGV4dCI6Ik1hbGUiLCAiZ3JvdXAiOiJHZW5kZXIifSx7InRleHQiOiJGZW1hbGUiLCAiZ3JvdXAiOiJHZW5kZXIifV0=", "value":"Female"}'></select>
<p>This example fetches select options from the server upon initialization using the <code>dataUrl</code> option.
The dataset should be of the form
<code>[{text:'option with explicit value', value: 'some value', group: 'Optional group name'}, {text:'option with implicit value'}]</code>.
The initial value can be set using the <code>value</code> option.
</p>
</span>
<span class="example">
<label for="select">
Disabled Options
</label>
<select>
<option></option>
<option>Jimmy Johnson</option>
<option>Amanda Hugginkiss</option>
<option disabled="disabled">Cosmo Kramer</option>
<option>Bob Zickowski</option>
<option>Nicholas Cage</option>
<option>Queen Latifah</option>
</select>
<p>This example has a disabled option that should not highlight or be selectable.</p>
</span>
<span class="example">
<label for="select">
Disabled Select
</label>
<select disabled="disabled">
<option></option>
<option>Jimmy Johnson</option>
<option>Amanda Hugginkiss</option>
<option>Cosmo Kramer</option>
<option>Bob Zickowski</option>
<option>Nicholas Cage</option>
<option>Queen Latifah</option>
</select>
<p>This example has a disabled select that should disable the entire UI.</p>
</span>
<span class="example">
<label for="select">
Selected Text
</label>
<select>
<option></option>
<option>Jimmy Johnson</option>
<option data-selected-text="Good Choice!">Custom Selected Text</option>
<option>Cosmo Kramer</option>
<option>Bob Zickowski</option>
<option>Nicholas Cage</option>
<option>Queen Latifah</option>
</select>
<p>This example has an option with <code>data-selected-text</code> that should show custom text in the output container when selected.</p>
</span>
<span class="example">
<label for="select">
Title Attribute
</label>
<select>
<option></option>
<option>Jimmy Johnson</option>
<option title="Cooltip!">Option with Title</option>
<option>Cosmo Kramer</option>
<option>Bob Zickowski</option>
<option>Nicholas Cage</option>
<option>Queen Latifah</option>
</select>
<p>This example has an option with a <code>title</code> attribute that should show as a tooltip.</p>
</span>
<span class="example">
<label for="select">
Form ENTER handling (should not submit form)
</label>
<form onsubmit="alert('Form submitted! This should NOT happen when pressing ENTER in the search field.'); return false;">
<select placeholder="Choose a gender">
<option></option>
<option>male</option>
<option>female</option>
</select>
<button type="submit">Submit Form</button>
</form>
</span>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="javascript/uber_search.js"></script>
<script src="javascript/uber_search/search_field.js"></script>
<script src="javascript/uber_search/list.js"></script>
<script src="javascript/uber_search/output_container.js"></script>
<script src="javascript/uber_search/search_model.js"></script>
<script src="javascript/uber_search/search.js"></script>
<script src="javascript/uber_search/pane.js"></script>
<script src="javascript/jquery.uber-select.js"></script>
<script type="text/javascript">
jQuery.noConflict()
jQuery('select').uberSelect({selectCaret: ''})
</script>
</body>
</html>