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>
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>
You can fix this issue by upgrading to a newer version of the r.js build tool.
</p>
</section>

View File

@ -2,24 +2,24 @@
<h2 id="data-attributes">
Can I declare my configuration within the HTML?
</h2>
<p>
It is recommended that you declare your configuration options for Select2
when initializing Select2. You can also define your configuration options
by using the HTML5 <code>data-*</code> attributes, which will override
any options set when initializing Select2 and any defaults.
</p>
<h3>
How should <code>camelCase</code> options be written?
</h3>
<p>
This means that if you declare your <code>&lt;select&gt;</code> tag as...
</p>
<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>
<p>
@ -29,14 +29,15 @@
<pre class="prettyprint linenums">
$("select").select2({
tags: "true",
placeholder: "Select an option"
placeholder: "Select an option",
allowClear: true
});
</pre>
<h3>
Are options with nested configurations supported?
</h3>
<p>
You can also define nested configurations, which are typically needed for
options such as AJAX. Each level of nesting should be separated by two

View File

@ -3,7 +3,7 @@
How should Select2 be initialized?
</h2>
<h3>
<h3 id="setting-default-options">
Can default options be set for all dropdowns?
</h3>
@ -24,12 +24,7 @@
<p>
<strong>You can set default options</strong> by calling
<code>$.fn.select2.defaults.set("key", "value")</code>. 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.
<code>$.fn.select2.defaults.set("key", "value")</code>.
</p>
<pre class="prettyprint">
@ -40,6 +35,15 @@ $.fn.select2.defaults.set("theme", "classic");
How can I set a default value for a nested option?
</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>
How can I reset all of the global default options?
</h3>