1
0
mirror of synced 2024-11-26 23:06:02 +03:00

Set up initial page with some questions

Right now this sets up the new FAQ/Options page with most of the
questions for the how to control the selection. Not all of these
questions have answers, most of them weren't moved over, but there are
plans to add detailed answers to all of them.

The questions were aggregated based on common Stack Overflow and IRC
questions, as well as commonly asked things on GitHub.
This commit is contained in:
Kevin Brown 2015-08-29 19:51:52 -04:00
parent ea074af14c
commit 41e4795578
10 changed files with 196 additions and 0 deletions

View File

@ -0,0 +1,8 @@
<section>
<h1>
Core options
</h1>
{% include options-new/core/data-attributes.html %}
{% include options-new/core/amd-support.html %}
</section>

View File

@ -0,0 +1,13 @@
<section>
<h2 id="amd">
Can I use Select2 with my AMD or CommonJS loader?
</h2>
<h3>
How do I tell Select2 where to look for modules?
</h3>
<h3>
Select2 is being placed before jQuery in my JavaScript file
</h3>
</section>

View File

@ -0,0 +1,71 @@
<section>
<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;
</pre>
<p>
Will be interpreted the same as initializing Select2 as...
</p>
<pre class="prettyprint linenums">
$("select").select2({
tags: "true",
placeholder: "Select an option"
});
</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
dashes (<code>--</code>) instead of one. Due to
<a href="https://github.com/jquery/jquery/issues/2070">a jQuery bug</a>,
nested options using <code>data-*</code> attributes
<a href="https://github.com/select2/select2/issues/2969">do not work in jQuery 1.x</a>.
</p>
<pre class="prettyprint">
&lt;select data-ajax--url="http://example.org/api/test" data-ajax--cache="true"&gt;&lt;/select&gt;
</pre>
<p>
Which will be interpreted the same as initializing Select2 with...
</p>
<pre class="prettyprint linenums">
$("select").select2({
ajax: {
url: "http://example.org/api/test",
cache: "true"
}
});
</pre>
<p>
The value of the option is subject to jQuery's
<a href="https://api.jquery.com/data/#data-html5">parsing rules</a> for
HTML5 data attributes.
</p>
</section>

View File

@ -0,0 +1,5 @@
<section>
<p>
This documentation is set up in the form of a FAQ.
</p>
</section>

View File

@ -0,0 +1,10 @@
<section>
<h1>
Selections
</h1>
{% include options-new/selections/multiple.html %}
{% include options-new/selections/placeholder.html %}
{% include options-new/selections/clearing-selections.html %}
{% include options-new/selections/templating.html %}
</section>

View File

@ -0,0 +1,13 @@
<section>
<h2 id="allowClear">
Can I allow users to clear their selections?
</h2>
<h3>
The "x" icon is not clearing the selection
</h3>
<h3>
Can users remove all of their selections in a multiple select at once?
</h3>
</section>

View File

@ -0,0 +1,5 @@
<section>
<h2 id="multiple">
Can I allow users to make multiple selections?
</h2>
</section>

View File

@ -0,0 +1,21 @@
<section>
<h2 id="placeholder">
How can I have Select2 display a placeholder?
</h2>
<h3>
My first option is being displayed instead of my placeholder
</h3>
<h3>
I am using AJAX, can I still show a placeholder?
</h3>
<h3>
Can I use a placeholder without a blank value?
</h3>
<h3>
Can I change how the placeholder looks?
</h3>
</section>

View File

@ -0,0 +1,17 @@
<section>
<h2 id="templateSelection">
How can I customize the way selections are displayed?
</h2>
<h3>
Nothing is being displayed when I select an option
</h3>
<h3>
I am using HTML in my selection template but it isn't displaying it
</h3>
<h3>
How can I access the container where the selection is displayed?
</h3>
</section>

33
docs/options-new.html Normal file
View File

@ -0,0 +1,33 @@
---
layout: default
title: Options - Select2
slug: options
---
<section class="jumbotron">
<div class="container">
<h1>
Options
</h1>
<p class="lead">
Select2 supports a wide variety of options that allow you to customize it to your needs.
</p>
</div>
</section>
<div class="container s2-docs-container">
<div class="row">
<div class="col-md-9" role="main">
{% include options-new/introduction.html %}
{% include options-new/core.html %}
{% include options-new/selections.html %}
</div>
<div class="col-md-3" role="complementary">
{% include nav/options.html %}
</div>
</div>
</div>
<script type="text/javascript">
prettyPrint();
</script>