Skip to content

Commit e472cb3

Browse files
committed
Finish off the core option answers
These were mostly there before, it was just a matter of moving some of the answers around.
1 parent 4541d83 commit e472cb3

3 files changed

Lines changed: 23 additions & 14 deletions

File tree

docs/_includes/options-new/core/amd-support.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,8 @@ <h3>
3131
<p>
3232
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.
3333
</p>
34+
35+
<p>
36+
You can fix this issue by upgrading to a newer version of the r.js build tool.
37+
</p>
3438
</section>

docs/_includes/options-new/core/data-attributes.html

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,24 @@
22
<h2 id="data-attributes">
33
Can I declare my configuration within the HTML?
44
</h2>
5-
5+
66
<p>
77
It is recommended that you declare your configuration options for Select2
88
when initializing Select2. You can also define your configuration options
99
by using the HTML5 <code>data-*</code> attributes, which will override
1010
any options set when initializing Select2 and any defaults.
1111
</p>
12-
12+
1313
<h3>
1414
How should <code>camelCase</code> options be written?
1515
</h3>
16-
16+
1717
<p>
1818
This means that if you declare your <code>&lt;select&gt;</code> tag as...
1919
</p>
2020

2121
<pre class="prettyprint">
22-
&lt;select data-tags="true" data-placeholder="Select an option"&gt;&lt;/select&gt;
22+
&lt;select data-tags="true" data-placeholder="Select an option" data-allow-clear="true"&gt;&lt;/select&gt;
2323
</pre>
2424

2525
<p>
@@ -29,14 +29,15 @@ <h3>
2929
<pre class="prettyprint linenums">
3030
$("select").select2({
3131
tags: "true",
32-
placeholder: "Select an option"
32+
placeholder: "Select an option",
33+
allowClear: true
3334
});
3435
</pre>
35-
36+
3637
<h3>
3738
Are options with nested configurations supported?
3839
</h3>
39-
40+
4041
<p>
4142
You can also define nested configurations, which are typically needed for
4243
options such as AJAX. Each level of nesting should be separated by two

docs/_includes/options-new/core/options.html

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ <h2 id="options">
33
How should Select2 be initialized?
44
</h2>
55

6-
<h3>
6+
<h3 id="setting-default-options">
77
Can default options be set for all dropdowns?
88
</h3>
99

@@ -24,12 +24,7 @@ <h3>
2424

2525
<p>
2626
<strong>You can set default options</strong> by calling
27-
<code>$.fn.select2.defaults.set("key", "value")</code>. The key that is
28-
set should take the same format as keys set using
29-
<a href="#data-attributes">HTML <code>data-*</code> attributes</a> which
30-
means that two dashes (<code>--</code>) will be replaced by a level of
31-
nesting, and a single dash (<code>-</code>) will convert it to a camelCase
32-
string.
27+
<code>$.fn.select2.defaults.set("key", "value")</code>.
3328
</p>
3429

3530
<pre class="prettyprint">
@@ -40,6 +35,15 @@ <h3>
4035
How can I set a default value for a nested option?
4136
</h3>
4237

38+
<p>
39+
The key that is
40+
set should take the same format as keys set using
41+
<a href="#data-attributes">HTML <code>data-*</code> attributes</a> which
42+
means that two dashes (<code>--</code>) will be replaced by a level of
43+
nesting, and a single dash (<code>-</code>) will convert it to a camelCase
44+
string.
45+
</p>
46+
4347
<h3>
4448
How can I reset all of the global default options?
4549
</h3>

0 commit comments

Comments
 (0)