/[projects]/misc/horsensspejder-web/jquery/chosen_v1.0.0/options.html
ViewVC logotype

Contents of /misc/horsensspejder-web/jquery/chosen_v1.0.0/options.html

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2125 - (show annotations) (download) (as text)
Wed Mar 12 19:30:05 2014 UTC (10 years, 2 months ago) by torben
File MIME type: text/html
File size: 10657 byte(s)
initial import
1 <!doctype html>
2 <html lang="en">
3 <head>
4 <meta charset="utf-8">
5 <title>Chosen: A jQuery Plugin by Harvest to Tame Unwieldy Select Boxes</title>
6 <link rel="stylesheet" href="docsupport/style.css">
7 <link rel="stylesheet" href="docsupport/prism.css">
8 <link rel="stylesheet" href="chosen.css">
9 <style type="text/css" media="all">
10 /* fix rtl for demo */
11 .chosen-rtl .chosen-drop { left: -9000px; }
12 </style>
13 </head>
14 <body>
15 <div id="container">
16 <div id="content">
17 <header>
18 <h1>Chosen</h1>
19 </header>
20 <p>Chosen has a number of options and attributes that allow you to have full control of your select boxes.</p>
21
22 <h2><a name="options" class="anchor" href="#options">Options</a></h2>
23 <p>The following options are available to pass into Chosen on instantiation.</p>
24
25 <h3>Example:</h3>
26 <pre>
27 <code class="language-javascript">$(".my_select_box").chosen(
28 disable_search_threshold: 10,
29 no_results_text: "Oops, nothing found!",
30 width: "95%"
31 );</code>
32 </pre>
33
34 <table class="docs-table">
35 <tr>
36 <th>Option</th><th>Default</th><th>Description</th>
37 </tr>
38 <tr>
39 <td>allow_single_deselect</td>
40 <td>false</td>
41 <td>When set to <code class="language-javascript">true</code> on a single select, Chosen adds a UI element which selects the first elment (if it is blank).</td>
42 </tr>
43 <tr>
44 <td>disable_search</td>
45 <td>false</td>
46 <td>When set to <code class="language-javascript">true</code>, Chosen will not display the search field (single selects only).</td>
47 </tr>
48 <tr>
49 <td>disable_search_threshold</td>
50 <td>0</td>
51 <td>Hide the search input on single selects if there are fewer than (n) options.</td>
52 </tr>
53 <tr>
54 <td>enable_split_word_search</td>
55 <td>true</td>
56 <td>By default, searching will match on any word within an option tag. Set this option to <code class="language-javascript">false</code> if you want to only match on the entire text of an option tag.</td>
57 </tr>
58 <tr>
59 <td>inherit_select_classes</td>
60 <td>false</td>
61 <td>When set to <code class="language-javascript">true</code>, Chosen will grab any classes on the original select field and add them to Chosen's container div.</td>
62 </tr>
63 <tr>
64 <tr>
65 <td>max_selected_options</td>
66 <td>Infinity</td>
67 <td>Limits how many options the user can select. When the limit is reached, the <code class="language-javascript">chosen:maxselected</code> event is triggered.</td>
68 </tr>
69 <tr>
70 <td>no_results_text</td>
71 <td>"No results match"</td>
72 <td>The text to be displayed when no matching results are found. The current search is shown at the end of the text (e.g.
73 No reults match "Bad Search").</td>
74 </tr>
75 <tr>
76 <td>placeholder_text_multiple</td>
77 <td>"Select Some Options"</td>
78 <td>The text to be displayed as a placeholder when no options are selected for a multiple select.</td>
79 </tr>
80 </tr>
81 <td>placeholder_text_single</td>
82 <td>"Select an Option"</td>
83 <td>The text to be displayed as a placeholder when no options are selected for a single select.</td>
84 </tr>
85 <tr>
86 <td>search_contains</td>
87 <td>false</td>
88 <td>By default, Chosen's search matches starting at the beginning of a word. Setting this option to <code class="language-javascript">true</code> allows matches starting from anywhere within a word. This is especially useful for options that include a lot of special characters or phrases in ()'s and []'s.</td>
89 </tr>
90 <tr>
91 <td>single_backstroke_delete</td>
92 <td>true</td>
93 <td>By default, pressing delete/backspace on multiple selects will remove a selected choice. When <code class="language-javascript">false</code>, pressing delete/backspace will highlight the last choice, and a second press deselects it.</td>
94 </tr>
95 <tr>
96 <td>width</td>
97 <td>Original select width.</td>
98 <td>The width of the Chosen select box. By default, Chosen attempts to match the width of the select box you are replacing. If your select is hidden when Chosen is instantiated, you must specify a width or the select will show up with a width of 0.</td>
99 </tr>
100 <tr>
101 <td>display_disabled_options</td>
102 <td>true</td>
103 <td>By default, Chosen includes disabled options in search results with a special styling. Setting this option to false will hide disabled results and exclude them from searches.</td>
104 </tr>
105 <tr>
106 <td>display_selected_options</td>
107 <td>true</td>
108 <td>
109 <p>By default, Chosen includes selected options in search results with a special styling. Setting this option to false will hide selected results and exclude them from searches.</p>
110 <p><strong>Note:</strong> this is for multiple selects only. In single selects, the selected result will always be displayed.</p>
111 </td>
112 </tr>
113 </table>
114
115 <h2><a name="attributes" class="anchor" href="#attributes">Attributes</a></h2>
116 <p>Certain attributes placed on the select tag or its options can be used to configure Chosen.</p>
117
118 <h3>Example:</h3>
119
120 <pre>
121 <code class="language-markup">&lt;select class="my_select_box" data-placeholder="Select Your Options"&gt;
122 &lt;option value="1"&gt;Option 1&lt;/option&gt;
123 &lt;option value="2" selected&gt;Option 2&lt;/option&gt;
124 &lt;option value="3" disabled&gt;Option 3&lt;/option&gt;
125 &lt;/select&gt;</code>
126 </pre>
127
128 <table class="docs-table">
129 <tr>
130 <th>Attribute</th><th>Description</th>
131 </tr>
132 <tr>
133 <td>data-placeholder</td>
134 <td>
135 </p>The text to be displayed as a placeholder when no options are selected for a select. Defaults to "Select an Option" for single selects or "Select Some Options" for multiple selects.</p>
136 <p><strong>Note:</strong>This attribute overrides anything set in the <code class="language-javascript">placeholder_text_multiple</code> or <code class="language-javascript">placeholder_text_single</code> options.</p>
137 </td>
138 </tr>
139 <tr>
140 <td>multiple</td>
141 <td>The attribute <code class="language-html">multiple</code> on your select box dictates whether Chosen will render a multiple or single select.</td>
142 </tr>
143 <tr>
144 <td>selected, disabled</td>
145 <td>Chosen automatically highlights selected options and disables disabled options.</td>
146 </tr>
147 </table>
148
149 <h2><a name="classes" class="anchor" href="#classes">Classes</a></h2>
150 <p>Classes placed on the select tag can be used to configure Chosen.</p>
151
152 <h3>Example:</h3>
153
154 <pre>
155 <code class="language-markup">&lt;select class="my_select_box chosen-rtl"&gt;
156 &lt;option value="1"&gt;Option 1&lt;/option&gt;
157 &lt;option value="2"&gt;Option 2&lt;/option&gt;
158 &lt;option value="3"&gt;Option 3&lt;/option&gt;
159 &lt;/select&gt;</code>
160 </pre>
161
162 <table class="docs-table">
163 <tr>
164 <th>Classname</th>
165 <th>Description</th>
166 <tr>
167 <td>chosen-rtl</td>
168 <td>
169 <p>Chosen supports right-to-left text in select boxes. Add the class <code class="language-html">chosen-rtl</code> to your select tag to support right-to-left text options.</p>
170 <p><strong>Note:</strong> The <code class="language-html">chosen-rtl</code> class will pass through to the Chosen select even when the <code class="language-javascript">inherit_select_classes</code> option is set to <code class="language-javascript">false</code>.</p>
171 </td>
172 <tr>
173 </table>
174
175 <h2><a name="events" class="anchor" href="#events">Events</a></h2>
176 <p>Chosen triggers a number of standard and custom events on the original select field.</p>
177
178 <h3>Example:</h3>
179
180 <pre>
181 <code class="language-javascript">$('select').on('change', function(evt, params) {
182 do_something(evt, params);
183 });</code>
184 </pre>
185
186 <table class="docs-table">
187 <tr>
188 <th>Event</th><th>Description</th>
189 </tr>
190 <tr>
191 <td>change</td>
192 <td>
193 <p>Chosen triggers the standard DOM event whenever a selection is made (it also sends a <code class="language-javascript">selected</code> or <code class="language-javascript">deselected</code> parameter that tells you which option was changed).</p>
194 <p><strong>Note:</strong> in order to use change in the Prototype version, you have to include the <a href="https://github.com/kangax/protolicious/blob/5b56fdafcd7d7662c9d648534225039b2e78e371/event.simulate.js">Event.simulate</a> class. The selected and deselected parameters are not available for Prototype.</p>
195 </td>
196 </tr>
197 <tr>
198 <td>chosen:ready</td>
199 <td>after Chosen has been fully instantiated (it also sends the <code class="language-javascript">chosen</code> object as a parameter).</td>
200 </tr>
201 <tr>
202 <td>chosen:maxselected</td>
203 <td>triggered if <code class="language-javascript">max_selected_options</code> is set and that total is broken. (it also sends the <code class="language-javascript">chosen</code> object as a parameter)</td>
204 </tr>
205 <tr>
206 <td>chosen:showing_dropdown</td>
207 <td>triggered when Chosen's dropdown is opened (it also sends the <code class="language-javascript">chosen</code> object as a parameter).</td>
208 </tr>
209 <tr>
210 <td>chosen:hiding_dropdown</td>
211 <td>triggered when Chosen's dropdown is closed (it also sends the <code class="language-javascript">chosen</code> object as a parameter).</td>
212 </tr>
213 </table>
214
215 <footer>
216 &copy; 2011&ndash;2013 <a href="http://www.getharvest.com/">Harvest</a>. Chosen is licensed under the <a href="https://github.com/harvesthq/chosen/blob/master/LICENSE.md">MIT license</a>.
217 </footer>
218
219 </div>
220 </div>
221 <div class="oss-bar">
222 <ul>
223 <li><a class="fork" href="https://github.com/harvesthq/chosen">Fork on Github</a></li>
224 <li><a class="harvest" href="http://www.getharvest.com/">Built by Harvest</a></li>
225 </ul>
226 </div>
227 <script src="docsupport/prism.js" type="text/javascript" charset="utf-8"></script>
228 </body>
229 </html>

  ViewVC Help
Powered by ViewVC 1.1.20