1
0
mirror of synced 2025-02-04 06:09:23 +03:00

Finish off the core option answers

These were mostly there before, it was just a matter of moving some of
the answers around.
This commit is contained in:
Kevin Brown 2015-09-13 11:31:06 -04:00
parent 4541d83c5d
commit e472cb31f0
3 changed files with 23 additions and 14 deletions

View File

@ -31,4 +31,8 @@ $.fn.select2.defaults.set('amdLanguageBase', 'select2/i18n/');
<p> <p>
Due to a bug in older versions of the r.js build tool, Select2 was sometimes placed before jQuery in then compiled build file. Because of this, Select2 will trigger an error because it won't be able to find or load jQuery. Due to a bug in older versions of the r.js build tool, Select2 was sometimes placed before jQuery in then compiled build file. Because of this, Select2 will trigger an error because it won't be able to find or load jQuery.
</p> </p>
<p>
You can fix this issue by upgrading to a newer version of the r.js build tool.
</p>
</section> </section>

View File

@ -19,7 +19,7 @@
</p> </p>
<pre class="prettyprint"> <pre class="prettyprint">
&lt;select data-tags="true" data-placeholder="Select an option"&gt;&lt;/select&gt; &lt;select data-tags="true" data-placeholder="Select an option" data-allow-clear="true"&gt;&lt;/select&gt;
</pre> </pre>
<p> <p>
@ -29,7 +29,8 @@
<pre class="prettyprint linenums"> <pre class="prettyprint linenums">
$("select").select2({ $("select").select2({
tags: "true", tags: "true",
placeholder: "Select an option" placeholder: "Select an option",
allowClear: true
}); });
</pre> </pre>

View File

@ -3,7 +3,7 @@
How should Select2 be initialized? How should Select2 be initialized?
</h2> </h2>
<h3> <h3 id="setting-default-options">
Can default options be set for all dropdowns? Can default options be set for all dropdowns?
</h3> </h3>
@ -24,12 +24,7 @@
<p> <p>
<strong>You can set default options</strong> by calling <strong>You can set default options</strong> by calling
<code>$.fn.select2.defaults.set("key", "value")</code>. The key that is <code>$.fn.select2.defaults.set("key", "value")</code>.
set should take the same format as keys set using
<a href="#data-attributes">HTML <code>data-*</code> attributes</a> which
means that two dashes (<code>--</code>) will be replaced by a level of
nesting, and a single dash (<code>-</code>) will convert it to a camelCase
string.
</p> </p>
<pre class="prettyprint"> <pre class="prettyprint">
@ -40,6 +35,15 @@ $.fn.select2.defaults.set("theme", "classic");
How can I set a default value for a nested option? How can I set a default value for a nested option?
</h3> </h3>
<p>
The key that is
set should take the same format as keys set using
<a href="#data-attributes">HTML <code>data-*</code> attributes</a> which
means that two dashes (<code>--</code>) will be replaced by a level of
nesting, and a single dash (<code>-</code>) will convert it to a camelCase
string.
</p>
<h3> <h3>
How can I reset all of the global default options? How can I reset all of the global default options?
</h3> </h3>