Fix indention, consistently declare anchor-nav relevant IDs for <h1> (instead of <section>).
This commit is contained in:
parent
dc679f7cbd
commit
922d54615f
@ -1,30 +1,30 @@
|
||||
<section id="adapters">
|
||||
<div class="page-header">
|
||||
<h1>Adapters</h1>
|
||||
</div>
|
||||
<section>
|
||||
<div class="page-header">
|
||||
<h1 id="adapters">Adapters</h1>
|
||||
</div>
|
||||
|
||||
<p>
|
||||
Select2 allows plugins to add additional functionality through the core
|
||||
adapters. You can change almost anything involving the way Select2 works
|
||||
to the way Select2 interacts with the page by modifying the core adapters.
|
||||
Most third-party plugins should provide decorators (used to wrap adapters)
|
||||
and custom adapters that you can use.
|
||||
</p>
|
||||
<p>
|
||||
Select2 allows plugins to add additional functionality through the core
|
||||
adapters. You can change almost anything involving the way Select2 works
|
||||
to the way Select2 interacts with the page by modifying the core adapters.
|
||||
Most third-party plugins should provide decorators (used to wrap adapters)
|
||||
and custom adapters that you can use.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Each adapter contains a set of methods which will must always be defined.
|
||||
Along with the global methods that all adapters must implement, these
|
||||
methods must be implemented.
|
||||
</p>
|
||||
<p>
|
||||
Each adapter contains a set of methods which will must always be defined.
|
||||
Along with the global methods that all adapters must implement, these
|
||||
methods must be implemented.
|
||||
</p>
|
||||
|
||||
<h2 id="adapters-all">
|
||||
All adapters
|
||||
</h2>
|
||||
<h2 id="adapters-all">
|
||||
All adapters
|
||||
</h2>
|
||||
|
||||
<p>
|
||||
All adapters must implement a set of methods that Select2 will use to
|
||||
display them and bind any internal events.
|
||||
</p>
|
||||
<p>
|
||||
All adapters must implement a set of methods that Select2 will use to
|
||||
display them and bind any internal events.
|
||||
</p>
|
||||
|
||||
<pre class="prettyprint linenums">
|
||||
// The basic HTML that should be rendered by Select2. A jQuery or DOM element
|
||||
@ -66,34 +66,34 @@ Adapter.position = function ($rendered, $defaultContainer) { };
|
||||
Adapter.destroy = function () { };
|
||||
</pre>
|
||||
|
||||
<h2 id="selectionAdapter">
|
||||
Container (selection)
|
||||
</h2>
|
||||
<h2 id="selectionAdapter">
|
||||
Container (selection)
|
||||
</h2>
|
||||
|
||||
<p>
|
||||
The selection is what is shown to the user as a replacement of the
|
||||
standard <code><select></code> box. It controls the display of the
|
||||
selection option(s), as well anything else that needs to be embedded
|
||||
within the container, such as a search box.
|
||||
</p>
|
||||
<p>
|
||||
The selection is what is shown to the user as a replacement of the
|
||||
standard <code><select></code> box. It controls the display of the
|
||||
selection option(s), as well anything else that needs to be embedded
|
||||
within the container, such as a search box.
|
||||
</p>
|
||||
|
||||
<dl class="dl-horizontal">
|
||||
<dt>Key</dt>
|
||||
<dd>
|
||||
<code>selectionAdapter</code>
|
||||
</dd>
|
||||
<dl class="dl-horizontal">
|
||||
<dt>Key</dt>
|
||||
<dd>
|
||||
<code>selectionAdapter</code>
|
||||
</dd>
|
||||
|
||||
<dt>Default</dt>
|
||||
<dd>
|
||||
<code title="select2/selection/single">SingleSelection</code> or
|
||||
<code title="select2/selection/multiple">MultipleSelection</code>
|
||||
</dd>
|
||||
<dt>Default</dt>
|
||||
<dd>
|
||||
<code title="select2/selection/single">SingleSelection</code> or
|
||||
<code title="select2/selection/multiple">MultipleSelection</code>
|
||||
</dd>
|
||||
|
||||
<dt>Base</dt>
|
||||
<dd>
|
||||
<code title="select2/selection/base">BaseSelection</code>
|
||||
</dd>
|
||||
</dl>
|
||||
<dt>Base</dt>
|
||||
<dd>
|
||||
<code title="select2/selection/base">BaseSelection</code>
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
<pre class="prettyprint linenums">
|
||||
// Update the selected data.
|
||||
@ -106,31 +106,31 @@ Adapter.destroy = function () { };
|
||||
SelectionAdapter.update = function (data) { };
|
||||
</pre>
|
||||
|
||||
<h2 id="dataAdapter">
|
||||
Data set
|
||||
</h2>
|
||||
<h2 id="dataAdapter">
|
||||
Data set
|
||||
</h2>
|
||||
|
||||
<p>
|
||||
The data set is what Select2 uses to generate the possible results that
|
||||
can be selected, as well as the currently selected results.
|
||||
</p>
|
||||
<p>
|
||||
The data set is what Select2 uses to generate the possible results that
|
||||
can be selected, as well as the currently selected results.
|
||||
</p>
|
||||
|
||||
<dl class="dl-horizontal">
|
||||
<dt>Key</dt>
|
||||
<dd>
|
||||
<code>dataAdapter</code>
|
||||
</dd>
|
||||
<dl class="dl-horizontal">
|
||||
<dt>Key</dt>
|
||||
<dd>
|
||||
<code>dataAdapter</code>
|
||||
</dd>
|
||||
|
||||
<dt>Default</dt>
|
||||
<dd>
|
||||
<code title="select2/data/select">SelectAdapter</code>
|
||||
</dd>
|
||||
<dt>Default</dt>
|
||||
<dd>
|
||||
<code title="select2/data/select">SelectAdapter</code>
|
||||
</dd>
|
||||
|
||||
<dt>Base</dt>
|
||||
<dd>
|
||||
<code title="select2/data/base">BaseAdapter</code>
|
||||
</dd>
|
||||
</dl>
|
||||
<dt>Base</dt>
|
||||
<dd>
|
||||
<code title="select2/data/base">BaseAdapter</code>
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
<pre class="prettyprint linenums">
|
||||
// Get the currently selected options. This is called when trying to get the
|
||||
@ -160,50 +160,50 @@ DataAdapter.query = function (params, callback) {
|
||||
}
|
||||
</pre>
|
||||
|
||||
<h2 id="dropdownAdapter">
|
||||
Dropdown
|
||||
</h2>
|
||||
<h2 id="dropdownAdapter">
|
||||
Dropdown
|
||||
</h2>
|
||||
|
||||
<p>
|
||||
The dropdown adapter defines the main container that the dropdown should
|
||||
be held in. <strong>It does not define any extra methods that can be used
|
||||
for decorators</strong>, but it is common for decorators to attach to the
|
||||
<code>render</code> and <code>position</code> methods to alter how the
|
||||
dropdown is altered and positioned.
|
||||
</p>
|
||||
<p>
|
||||
The dropdown adapter defines the main container that the dropdown should
|
||||
be held in. <strong>It does not define any extra methods that can be used
|
||||
for decorators</strong>, but it is common for decorators to attach to the
|
||||
<code>render</code> and <code>position</code> methods to alter how the
|
||||
dropdown is altered and positioned.
|
||||
</p>
|
||||
|
||||
<dl class="dl-horizontal">
|
||||
<dt>Key</dt>
|
||||
<dd>
|
||||
<code>dropdownAdapter</code>
|
||||
</dd>
|
||||
<dl class="dl-horizontal">
|
||||
<dt>Key</dt>
|
||||
<dd>
|
||||
<code>dropdownAdapter</code>
|
||||
</dd>
|
||||
|
||||
<dt>Default</dt>
|
||||
<dd>
|
||||
<code title="select2/dropdown">DropdownAdapter</code>
|
||||
</dd>
|
||||
</dl>
|
||||
<dt>Default</dt>
|
||||
<dd>
|
||||
<code title="select2/dropdown">DropdownAdapter</code>
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
<h2 id="resultsAdapter">
|
||||
Results
|
||||
</h2>
|
||||
<h2 id="resultsAdapter">
|
||||
Results
|
||||
</h2>
|
||||
|
||||
<p>
|
||||
The results adapter controls the list of results that the user can select
|
||||
from. While the results adapter does not define any additional methods
|
||||
that must be implemented, it makes extensive use of the Select2 event
|
||||
system for controlling the display of results and messages.
|
||||
</p>
|
||||
<p>
|
||||
The results adapter controls the list of results that the user can select
|
||||
from. While the results adapter does not define any additional methods
|
||||
that must be implemented, it makes extensive use of the Select2 event
|
||||
system for controlling the display of results and messages.
|
||||
</p>
|
||||
|
||||
<dl class="dl-horizontal">
|
||||
<dt>Key</dt>
|
||||
<dd>
|
||||
<code>resultsAdapter</code>
|
||||
</dd>
|
||||
<dl class="dl-horizontal">
|
||||
<dt>Key</dt>
|
||||
<dd>
|
||||
<code>resultsAdapter</code>
|
||||
</dd>
|
||||
|
||||
<dt>Default</dt>
|
||||
<dd>
|
||||
<code title="select2/results">ResultsAdapter</code>
|
||||
</dd>
|
||||
</dl>
|
||||
</section>
|
||||
<dt>Default</dt>
|
||||
<dd>
|
||||
<code title="select2/results">ResultsAdapter</code>
|
||||
</dd>
|
||||
</dl>
|
||||
</section>
|
||||
|
@ -1,201 +1,200 @@
|
||||
<section id="compatibility">
|
||||
<div class="page-header">
|
||||
<h1>Backwards compatibility</h1>
|
||||
</div>
|
||||
<section>
|
||||
<div class="page-header">
|
||||
<h1 id="compatibility">Backwards compatibility</h1>
|
||||
</div>
|
||||
|
||||
<p>
|
||||
Select2 offers limited backwards compatibility with the previously 3.5.x
|
||||
release line, allowing people more efficiently transfer across releases
|
||||
and get the latest features. For many of the larger changes, such as the
|
||||
change in how custom data adapters work, compatibility modules were
|
||||
created that will be used to assist in the upgrade process. It is not
|
||||
recommended to rely on these compatibility modules, as they will not
|
||||
always exist, but they make upgrading easier for major changes.
|
||||
</p>
|
||||
<p>
|
||||
Select2 offers limited backwards compatibility with the previously 3.5.x
|
||||
release line, allowing people more efficiently transfer across releases
|
||||
and get the latest features. For many of the larger changes, such as the
|
||||
change in how custom data adapters work, compatibility modules were
|
||||
created that will be used to assist in the upgrade process. It is not
|
||||
recommended to rely on these compatibility modules, as they will not
|
||||
always exist, but they make upgrading easier for major changes.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>The compatibility modules are only included in the
|
||||
<a href="index.html#builds-full" class="alert-link">full builds</a> of
|
||||
Select2</strong>. These files end in <code>.full.js</code>, and the
|
||||
compatibility modules are prefixed with <code>select2/compat</code>.
|
||||
</p>
|
||||
<p>
|
||||
<strong>The compatibility modules are only included in the
|
||||
<a href="index.html#builds-full" class="alert-link">full builds</a> of
|
||||
Select2</strong>. These files end in <code>.full.js</code>, and the
|
||||
compatibility modules are prefixed with <code>select2/compat</code>.
|
||||
</p>
|
||||
|
||||
<h2 id="compat-matcher">
|
||||
Simplified function for matching data objects
|
||||
</h2>
|
||||
<h2 id="compat-matcher">
|
||||
Simplified function for matching data objects
|
||||
</h2>
|
||||
|
||||
<p class="alert alert-info">
|
||||
<a href="announcements-4.0.html#new-matcher" class="alert-link">Added in Select2 4.0.0.</a>
|
||||
This method was added to make upgrading easier from earlier versions of
|
||||
Select2.
|
||||
</p>
|
||||
<p class="alert alert-info">
|
||||
<a href="announcements-4.0.html#new-matcher" class="alert-link">Added in Select2 4.0.0.</a>
|
||||
This method was added to make upgrading easier from earlier versions of
|
||||
Select2.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
During the <a href="announcements-4.0.html">Select2 4.0.0 release</a>, the
|
||||
<code>matcher</code> function was changed to allow for more complex
|
||||
matching of nested objects.
|
||||
</p>
|
||||
<p>
|
||||
During the <a href="announcements-4.0.html">Select2 4.0.0 release</a>, the
|
||||
<code>matcher</code> function was changed to allow for more complex
|
||||
matching of nested objects.
|
||||
</p>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
<dl class="dl-horizontal">
|
||||
<dt>Key</dt>
|
||||
<dd>
|
||||
<code>matcher</code>
|
||||
</dd>
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
<dl class="dl-horizontal">
|
||||
<dt>Key</dt>
|
||||
<dd>
|
||||
<code>matcher</code>
|
||||
</dd>
|
||||
|
||||
<dt>Value</dt>
|
||||
<dd>
|
||||
A function taking a search <code>term</code> and the data object
|
||||
<code>text</code>.
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<dt>Value</dt>
|
||||
<dd>
|
||||
A function taking a search <code>term</code> and the data object
|
||||
<code>text</code>.
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-6">
|
||||
<dl class="dl-horizontal">
|
||||
<dt>Adapter</dt>
|
||||
<dd>
|
||||
<code title="select2/compat/matcher">oldMatcher</code>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<dl class="dl-horizontal">
|
||||
<dt>Adapter</dt>
|
||||
<dd>
|
||||
<code title="select2/compat/matcher">oldMatcher</code>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p>
|
||||
The <a href="examples.html#matcher">custom matcher example</a> provides a
|
||||
guide for how to use this in your own application. For those upgrading
|
||||
from older versions of Select2, you just need to wrap your old
|
||||
<code>matcher</code> with this function to maintain compatibility.
|
||||
</p>
|
||||
<p>
|
||||
The <a href="examples.html#matcher">custom matcher example</a> provides a
|
||||
guide for how to use this in your own application. For those upgrading
|
||||
from older versions of Select2, you just need to wrap your old
|
||||
<code>matcher</code> with this function to maintain compatibility.
|
||||
</p>
|
||||
|
||||
<h2 id="initSelection">
|
||||
Old initial selections with <code>initSelection</code>
|
||||
</h2>
|
||||
<h2 id="initSelection">
|
||||
Old initial selections with <code>initSelection</code>
|
||||
</h2>
|
||||
|
||||
<p class="alert alert-warning">
|
||||
<a href="announcements-4.0.html#removed-initselection" class="alert-link">Deprecated in Select2 4.0.</a>
|
||||
This has been replaced by another option and is only available in the
|
||||
<a href="index.html#builds-full" class="alert-link">full builds</a> of
|
||||
Select2.
|
||||
</p>
|
||||
<p class="alert alert-warning">
|
||||
<a href="announcements-4.0.html#removed-initselection" class="alert-link">Deprecated in Select2 4.0.</a>
|
||||
This has been replaced by another option and is only available in the
|
||||
<a href="index.html#builds-full" class="alert-link">full builds</a> of
|
||||
Select2.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
In the past, Select2 required an option called <code>initSelection</code>
|
||||
that was defined whenever a custom data source was being used, allowing
|
||||
for the initial selection for the component to be determined. This has
|
||||
been replaced by the <code>current</code> method on the
|
||||
<a href="#dataAdapter">data adapter</a>.
|
||||
</p>
|
||||
<p>
|
||||
In the past, Select2 required an option called <code>initSelection</code>
|
||||
that was defined whenever a custom data source was being used, allowing
|
||||
for the initial selection for the component to be determined. This has
|
||||
been replaced by the <code>current</code> method on the
|
||||
<a href="#dataAdapter">data adapter</a>.
|
||||
</p>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
<dl class="dl-horizontal">
|
||||
<dt>Key</dt>
|
||||
<dd>
|
||||
<code>initSelection</code>
|
||||
</dd>
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
<dl class="dl-horizontal">
|
||||
<dt>Key</dt>
|
||||
<dd>
|
||||
<code>initSelection</code>
|
||||
</dd>
|
||||
|
||||
<dt>Value</dt>
|
||||
<dd>
|
||||
A function taking a <code>callback</code>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<dt>Value</dt>
|
||||
<dd>
|
||||
A function taking a <code>callback</code>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-6">
|
||||
<dl class="dl-horizontal">
|
||||
<dt>Adapter</dt>
|
||||
<dd>
|
||||
<code title="select2/data/base">DataAdapter</code>
|
||||
</dd>
|
||||
<div class="col-sm-6">
|
||||
<dl class="dl-horizontal">
|
||||
<dt>Adapter</dt>
|
||||
<dd>
|
||||
<code title="select2/data/base">DataAdapter</code>
|
||||
</dd>
|
||||
|
||||
<dt>Decorator</dt>
|
||||
<dd>
|
||||
<code title="select2/compat/initSelection">InitSelection</code>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
<dt>Decorator</dt>
|
||||
<dd>
|
||||
<code title="select2/compat/initSelection">InitSelection</code>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h2 id="query">
|
||||
Querying old data with <code>query</code>
|
||||
</h2>
|
||||
<h2 id="query">
|
||||
Querying old data with <code>query</code>
|
||||
</h2>
|
||||
|
||||
<p class="alert alert-warning">
|
||||
<a href="announcements-4.0.html#query-to-data-adapter" class="alert-link">Deprecated in Select2 4.0.</a>
|
||||
This has been replaced by another option and is only available in the
|
||||
<a href="index.html#builds-full" class="alert-link">full builds</a> of
|
||||
Select2.
|
||||
</p>
|
||||
<p class="alert alert-warning">
|
||||
<a href="announcements-4.0.html#query-to-data-adapter" class="alert-link">Deprecated in Select2 4.0.</a>
|
||||
This has been replaced by another option and is only available in the
|
||||
<a href="index.html#builds-full" class="alert-link">full builds</a> of
|
||||
Select2.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
In the past, Select2 supported an option called <code>query</code> that
|
||||
allowed for a custom data source to be used. This option has been replaced
|
||||
by the <code>query</code> method on the
|
||||
<a href="#dataAdapter">data adapter</a> and takes a very similar set of
|
||||
parameters.
|
||||
</p>
|
||||
<p>
|
||||
In the past, Select2 supported an option called <code>query</code> that
|
||||
allowed for a custom data source to be used. This option has been replaced
|
||||
by the <code>query</code> method on the
|
||||
<a href="#dataAdapter">data adapter</a> and takes a very similar set of
|
||||
parameters.
|
||||
</p>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
<dl class="dl-horizontal">
|
||||
<dt>Key</dt>
|
||||
<dd>
|
||||
<code>query</code>
|
||||
</dd>
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
<dl class="dl-horizontal">
|
||||
<dt>Key</dt>
|
||||
<dd>
|
||||
<code>query</code>
|
||||
</dd>
|
||||
|
||||
<dt>Value</dt>
|
||||
<dd>
|
||||
A function taking <code>params</code> (including a <code>callback</code>)
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<dt>Value</dt>
|
||||
<dd>
|
||||
A function taking <code>params</code> (including a <code>callback</code>)
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-6">
|
||||
<dl class="dl-horizontal">
|
||||
<dt>Adapter</dt>
|
||||
<dd>
|
||||
<code title="select2/data/base">DataAdapter</code>
|
||||
</dd>
|
||||
<div class="col-sm-6">
|
||||
<dl class="dl-horizontal">
|
||||
<dt>Adapter</dt>
|
||||
<dd>
|
||||
<code title="select2/data/base">DataAdapter</code>
|
||||
</dd>
|
||||
|
||||
<dt>Decorator</dt>
|
||||
<dd>
|
||||
<code title="select2/compat/query">Query</code>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<dt>Decorator</dt>
|
||||
<dd>
|
||||
<code title="select2/compat/query">Query</code>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h2 id="input-fallback">
|
||||
Compatibility with <code><input type="text" /></code>
|
||||
</h2>
|
||||
<h2 id="input-fallback">
|
||||
Compatibility with <code><input type="text" /></code>
|
||||
</h2>
|
||||
|
||||
<p class="alert alert-warning">
|
||||
<a href="announcements-4.0.html#hidden-input" class="alert-link">Deprecated in Select2 4.0.</a>
|
||||
It is now encouraged to use the <code><select></code> tag instead.
|
||||
</p>
|
||||
<p class="alert alert-warning">
|
||||
<a href="announcements-4.0.html#hidden-input" class="alert-link">Deprecated in Select2 4.0.</a>
|
||||
It is now encouraged to use the <code><select></code> tag instead.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
In past versions of Select2, a <code><select></code> element could
|
||||
only be used with a limited subset of options. An
|
||||
<code><input type="hidden" /></code> was required instead, which did
|
||||
not allow for a graceful fallback for users who did not have JavaScript
|
||||
enabled. Select2 now supports the <code><select></code> element for
|
||||
all options, so it is no longer required to use <code><input /></code>
|
||||
elements with Select2.
|
||||
</p>
|
||||
<p>
|
||||
In past versions of Select2, a <code><select></code> element could
|
||||
only be used with a limited subset of options. An
|
||||
<code><input type="hidden" /></code> was required instead, which did
|
||||
not allow for a graceful fallback for users who did not have JavaScript
|
||||
enabled. Select2 now supports the <code><select></code> element for
|
||||
all options, so it is no longer required to use <code><input /></code>
|
||||
elements with Select2.
|
||||
</p>
|
||||
|
||||
<dl class="dl-horizontal">
|
||||
<dt>Adapter</dt>
|
||||
<dd>
|
||||
<code title="select2/data/base">DataAdapter</code>
|
||||
</dd>
|
||||
<dl class="dl-horizontal">
|
||||
<dt>Adapter</dt>
|
||||
<dd>
|
||||
<code title="select2/data/base">DataAdapter</code>
|
||||
</dd>
|
||||
|
||||
<dt>Decorator</dt>
|
||||
<dd>
|
||||
<code title="select2/compat/inputData">InputData</code>
|
||||
</dd>
|
||||
</dl>
|
||||
</section>
|
||||
<dt>Decorator</dt>
|
||||
<dd>
|
||||
<code title="select2/compat/inputData">InputData</code>
|
||||
</dd>
|
||||
</dl>
|
||||
</section>
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,116 +1,76 @@
|
||||
<section id="dropdown">
|
||||
<div class="page-header">
|
||||
<h1>Dropdown</h1>
|
||||
<section>
|
||||
<div class="page-header">
|
||||
<h1 id="dropdown">Dropdown</h1>
|
||||
</div>
|
||||
|
||||
<p>
|
||||
Select2 allows you to change the way that the dropdown works, allowing you
|
||||
to do anything from attach it to a different location in the document or
|
||||
add a search box.
|
||||
</p>
|
||||
|
||||
<h2 id="dropdownParent">
|
||||
Attached to body
|
||||
</h2>
|
||||
|
||||
<p>
|
||||
By default, Select2 will attach the dropdown to the end of the body and
|
||||
will absolutely position it to appear below the selection container.
|
||||
</p>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
<dl class="dl-horizontal">
|
||||
<dt>Key</dt>
|
||||
<dd><code>dropdownParent</code></dd>
|
||||
|
||||
<dt>Value</dt>
|
||||
<dd>jQuery element or DOM node</dd>
|
||||
|
||||
<hr />
|
||||
|
||||
<dt>Adapter</dt>
|
||||
<dd>
|
||||
<code title="select2/dropdown">DropdownAdapter</code>
|
||||
</dd>
|
||||
|
||||
<dt>Decorator</dt>
|
||||
<dd>
|
||||
<code title="select2/dropdown/attachBody">AttachBody</code>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-6">
|
||||
<div class="alert alert-warning">
|
||||
<strong>Heads up!</strong>
|
||||
This will cause DOM events to be raised outside of the standard
|
||||
Select2 DOM container. This can cause issues with
|
||||
third-party components such as modals.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p>
|
||||
Select2 allows you to change the way that the dropdown works, allowing you
|
||||
to do anything from attach it to a different location in the document or
|
||||
add a search box.
|
||||
</p>
|
||||
<p>
|
||||
When the dropdown is attached to the body, you are not limited to just
|
||||
displaying the dropdown below the container. Select2 will display above
|
||||
the container if there is not enough space below the container, but there
|
||||
is enough space above it. You are also not limited to displaying the
|
||||
dropdown within the parent container, which means Select2 will render
|
||||
correctly inside of modals and other small containers.
|
||||
</p>
|
||||
|
||||
<h2 id="dropdownParent">
|
||||
Attached to body
|
||||
</h2>
|
||||
<h2 id="dropdown-attachContainer">
|
||||
Attached below the container
|
||||
</h2>
|
||||
|
||||
<p>
|
||||
By default, Select2 will attach the dropdown to the end of the body and
|
||||
will absolutely position it to appear below the selection container.
|
||||
</p>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
<dl class="dl-horizontal">
|
||||
<dt>Key</dt>
|
||||
<dd><code>dropdownParent</code></dd>
|
||||
|
||||
<dt>Value</dt>
|
||||
<dd>jQuery element or DOM node</dd>
|
||||
|
||||
<hr />
|
||||
|
||||
<dt>Adapter</dt>
|
||||
<dd>
|
||||
<code title="select2/dropdown">DropdownAdapter</code>
|
||||
</dd>
|
||||
|
||||
<dt>Decorator</dt>
|
||||
<dd>
|
||||
<code title="select2/dropdown/attachBody">AttachBody</code>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-6">
|
||||
<div class="alert alert-warning">
|
||||
<strong>Heads up!</strong>
|
||||
This will cause DOM events to be raised outside of the standard
|
||||
Select2 DOM container. This can cause issues with
|
||||
third-party components such as modals.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p>
|
||||
When the dropdown is attached to the body, you are not limited to just
|
||||
displaying the dropdown below the container. Select2 will display above
|
||||
the container if there is not enough space below the container, but there
|
||||
is enough space above it. You are also not limited to displaying the
|
||||
dropdown within the parent container, which means Select2 will render
|
||||
correctly inside of modals and other small containers.
|
||||
</p>
|
||||
|
||||
<h2 id="dropdown-attachContainer">
|
||||
Attached below the container
|
||||
</h2>
|
||||
|
||||
<p>
|
||||
Select2 can place the dropdown directly after the selection container, so
|
||||
it will appear in the same location within the DOM as the rest of Select2.
|
||||
</p>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
<dl class="dl-horizontal">
|
||||
<dt>Adapter</dt>
|
||||
<dd>
|
||||
<code title="select2/dropdown">DropdownAdapter</code>
|
||||
</dd>
|
||||
|
||||
<dt>Decorator</dt>
|
||||
<dd>
|
||||
<code title="select2/dropdown/attachContainer">AttachContainer</code>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-6">
|
||||
<div class="alert alert-warning">
|
||||
<strong>Check your build.</strong> This module is only included in the
|
||||
<a href="index.html#builds-full" class="alert-link">full builds</a> of
|
||||
Select2.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="alert alert-info">
|
||||
<strong>
|
||||
<a href="https://harvesthq.github.io/chosen/">Harvest Chosen</a>
|
||||
migrators!
|
||||
</strong>
|
||||
If you are migrating to Select2 from Chosen, this option will cause
|
||||
Select2 to position the dropdown in a similar way.
|
||||
</div>
|
||||
|
||||
<h2 id="dropdown-search">
|
||||
Search
|
||||
</h2>
|
||||
|
||||
<p>
|
||||
Users can filter down the results by typing a search term into a box that
|
||||
is displayed at the top of the dropdown.
|
||||
</p>
|
||||
<p>
|
||||
Select2 can place the dropdown directly after the selection container, so
|
||||
it will appear in the same location within the DOM as the rest of Select2.
|
||||
</p>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
<dl class="dl-horizontal">
|
||||
<dt>Adapter</dt>
|
||||
<dd>
|
||||
@ -119,190 +79,230 @@
|
||||
|
||||
<dt>Decorator</dt>
|
||||
<dd>
|
||||
<code title="select2/dropdown/search">DropdownSearch</code>
|
||||
<code title="select2/dropdown/attachContainer">AttachContainer</code>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
<p>
|
||||
A search box is added to the top of the dropdown automatically for select
|
||||
boxes where only a single option can be selected.
|
||||
</p>
|
||||
|
||||
<h3 id="dropdown-minimumInputLength">
|
||||
Minimum search term length to filter results
|
||||
</h3>
|
||||
|
||||
<p>
|
||||
Sometimes when working with large data sets, it is more efficient to start
|
||||
filtering the results when the search term is a certain length. This is
|
||||
very common when working with remote data sets, as allows for only
|
||||
significant search terms to be used.
|
||||
</p>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
<dl class="dl-horizontal">
|
||||
<dt>Key</dt>
|
||||
<dd><code>minimumInputLength</code></dd>
|
||||
|
||||
<dt>Value</dt>
|
||||
<dd>integer</dd>
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-6">
|
||||
<dl class="dl-horizontal">
|
||||
<dt>Adapter</dt>
|
||||
<dd>
|
||||
<code title="select2/data/base">DataAdapter</code>
|
||||
</dd>
|
||||
|
||||
<dt>Decorator</dt>
|
||||
<dd>
|
||||
<code title="select2/data/minimumInputLength">MinimumInputLength</code>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<div class="alert alert-warning">
|
||||
<strong>Check your build.</strong> This module is only included in the
|
||||
<a href="index.html#builds-full" class="alert-link">full builds</a> of
|
||||
Select2.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h3 id="dropdown-maximumInputLength">
|
||||
Maximum search term length to filter results
|
||||
</h3>
|
||||
<div class="alert alert-info">
|
||||
<strong>
|
||||
<a href="https://harvesthq.github.io/chosen/">Harvest Chosen</a>
|
||||
migrators!
|
||||
</strong>
|
||||
If you are migrating to Select2 from Chosen, this option will cause
|
||||
Select2 to position the dropdown in a similar way.
|
||||
</div>
|
||||
|
||||
<p>
|
||||
In some cases, search terms need to be limited to a certain range. Select2
|
||||
allows you to limit the length of the search term such that it does not
|
||||
exceed a certain length.
|
||||
</p>
|
||||
<h2 id="dropdown-search">
|
||||
Search
|
||||
</h2>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
<dl class="dl-horizontal">
|
||||
<dt>Key</dt>
|
||||
<dd><code>maximumInputLength</code></dd>
|
||||
<p>
|
||||
Users can filter down the results by typing a search term into a box that
|
||||
is displayed at the top of the dropdown.
|
||||
</p>
|
||||
|
||||
<dt>Value</dt>
|
||||
<dd>integer</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<dl class="dl-horizontal">
|
||||
<dt>Adapter</dt>
|
||||
<dd>
|
||||
<code title="select2/dropdown">DropdownAdapter</code>
|
||||
</dd>
|
||||
|
||||
<div class="col-sm-6">
|
||||
<dl class="dl-horizontal">
|
||||
<dt>Adapter</dt>
|
||||
<dd>
|
||||
<code title="select2/data/base">DataAdapter</code>
|
||||
</dd>
|
||||
<dt>Decorator</dt>
|
||||
<dd>
|
||||
<code title="select2/dropdown/search">DropdownSearch</code>
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
<dt>Decorator</dt>
|
||||
<dd>
|
||||
<code title="select2/data/maximumInputLength">MaximumInputLength</code>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
<p>
|
||||
A search box is added to the top of the dropdown automatically for select
|
||||
boxes where only a single option can be selected.
|
||||
</p>
|
||||
|
||||
<h3 id="dropdown-maximumInputLength">
|
||||
Minimum results to display the search box
|
||||
</h3>
|
||||
<h3 id="dropdown-minimumInputLength">
|
||||
Minimum search term length to filter results
|
||||
</h3>
|
||||
|
||||
<p>
|
||||
When working with smaller data sets, the search box can take up more space
|
||||
that is necessary, as there are not enough results for filtering to be
|
||||
effective. Select2 allows you to only display the search box when the
|
||||
number of search results reaches a certain threshold.
|
||||
</p>
|
||||
<p>
|
||||
Sometimes when working with large data sets, it is more efficient to start
|
||||
filtering the results when the search term is a certain length. This is
|
||||
very common when working with remote data sets, as allows for only
|
||||
significant search terms to be used.
|
||||
</p>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
<dl class="dl-horizontal">
|
||||
<dt>Key</dt>
|
||||
<dd><code>minimumResultsForSearch</code></dd>
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
<dl class="dl-horizontal">
|
||||
<dt>Key</dt>
|
||||
<dd><code>minimumInputLength</code></dd>
|
||||
|
||||
<dt>Value</dt>
|
||||
<dd>integer</dd>
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-6">
|
||||
<dl class="dl-horizontal">
|
||||
<dt>Adapter</dt>
|
||||
<dd>
|
||||
<code title="select2/dropdown">DropdownAdapter</code>
|
||||
</dd>
|
||||
|
||||
<dt>Decorator</dt>
|
||||
<dd>
|
||||
<code title="select2/dropdown/minimumResultsForSearch">MinimumResultsForSearch</code>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h2 id="dropdown-select-on-close">
|
||||
Select the highlighted option on close
|
||||
</h2>
|
||||
|
||||
<p>
|
||||
When users close the dropdown, the last highlighted option can be
|
||||
automatically selected. This is commonly used in combination with
|
||||
<a href="#tags">tagging</a> and <a href="#placeholder">placeholders</a>
|
||||
and other situations where the user is required to select an option, or
|
||||
they need to be able to quickly select multiple options.
|
||||
</p>
|
||||
<dt>Value</dt>
|
||||
<dd>integer</dd>
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-6">
|
||||
<dl class="dl-horizontal">
|
||||
<dt>Adapter</dt>
|
||||
<dd>
|
||||
<code title="select2/results">ResultsAdapter</code>
|
||||
<code title="select2/data/base">DataAdapter</code>
|
||||
</dd>
|
||||
|
||||
<dt>Decorator</dt>
|
||||
<dd>
|
||||
<code title="select2/dropdown/selectOnClose">SelectOnClose</code>
|
||||
<code title="select2/data/minimumInputLength">MinimumInputLength</code>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h2 id="closeOnSelect">
|
||||
Close the dropdown when a result is selected
|
||||
</h2>
|
||||
<h3 id="dropdown-maximumInputLength">
|
||||
Maximum search term length to filter results
|
||||
</h3>
|
||||
|
||||
<p>
|
||||
Select2 will automatically close the dropdown when an element is selected,
|
||||
similar to what is done with a normal select box. This behavior can be
|
||||
changed though to keep the dropdown open when results are selected,
|
||||
allowing for multiple options to be selected quickly.
|
||||
</p>
|
||||
<p>
|
||||
In some cases, search terms need to be limited to a certain range. Select2
|
||||
allows you to limit the length of the search term such that it does not
|
||||
exceed a certain length.
|
||||
</p>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
<dl class="dl-horizontal">
|
||||
<dt>Key</dt>
|
||||
<dd><code>closeOnSelect</code></dd>
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
<dl class="dl-horizontal">
|
||||
<dt>Key</dt>
|
||||
<dd><code>maximumInputLength</code></dd>
|
||||
|
||||
<dt>Default</dt>
|
||||
<dd><code>true</code></dd>
|
||||
</dl>
|
||||
</div>
|
||||
<dt>Value</dt>
|
||||
<dd>integer</dd>
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-6">
|
||||
<dl class="dl-horizontal">
|
||||
<dt>Adapter</dt>
|
||||
<dd>
|
||||
<code title="select2/dropdown">DropdownAdapter</code>
|
||||
</dd>
|
||||
<div class="col-sm-6">
|
||||
<dl class="dl-horizontal">
|
||||
<dt>Adapter</dt>
|
||||
<dd>
|
||||
<code title="select2/data/base">DataAdapter</code>
|
||||
</dd>
|
||||
|
||||
<dt>Decorator</dt>
|
||||
<dd>
|
||||
<code title="select2/dropdown/closeOnSelect">CloseOnSelect</code>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
<dt>Decorator</dt>
|
||||
<dd>
|
||||
<code title="select2/data/maximumInputLength">MaximumInputLength</code>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p>
|
||||
If this decorator is not used (or <code>closeOnSelect</code> is set to
|
||||
<code>false</code>), the dropdown will not automatically close when a
|
||||
result is selected. The dropdown will also never close if the
|
||||
<kbd>ctrl</kbd> key is held down when the result is selected.
|
||||
</p>
|
||||
</section>
|
||||
<h3 id="dropdown-maximumInputLength">
|
||||
Minimum results to display the search box
|
||||
</h3>
|
||||
|
||||
<p>
|
||||
When working with smaller data sets, the search box can take up more space
|
||||
that is necessary, as there are not enough results for filtering to be
|
||||
effective. Select2 allows you to only display the search box when the
|
||||
number of search results reaches a certain threshold.
|
||||
</p>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
<dl class="dl-horizontal">
|
||||
<dt>Key</dt>
|
||||
<dd><code>minimumResultsForSearch</code></dd>
|
||||
|
||||
<dt>Value</dt>
|
||||
<dd>integer</dd>
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-6">
|
||||
<dl class="dl-horizontal">
|
||||
<dt>Adapter</dt>
|
||||
<dd>
|
||||
<code title="select2/dropdown">DropdownAdapter</code>
|
||||
</dd>
|
||||
|
||||
<dt>Decorator</dt>
|
||||
<dd>
|
||||
<code title="select2/dropdown/minimumResultsForSearch">MinimumResultsForSearch</code>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h2 id="dropdown-select-on-close">
|
||||
Select the highlighted option on close
|
||||
</h2>
|
||||
|
||||
<p>
|
||||
When users close the dropdown, the last highlighted option can be
|
||||
automatically selected. This is commonly used in combination with
|
||||
<a href="#tags">tagging</a> and <a href="#placeholder">placeholders</a>
|
||||
and other situations where the user is required to select an option, or
|
||||
they need to be able to quickly select multiple options.
|
||||
</p>
|
||||
|
||||
<dl class="dl-horizontal">
|
||||
<dt>Adapter</dt>
|
||||
<dd>
|
||||
<code title="select2/results">ResultsAdapter</code>
|
||||
</dd>
|
||||
|
||||
<dt>Decorator</dt>
|
||||
<dd>
|
||||
<code title="select2/dropdown/selectOnClose">SelectOnClose</code>
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
<h2 id="closeOnSelect">
|
||||
Close the dropdown when a result is selected
|
||||
</h2>
|
||||
|
||||
<p>
|
||||
Select2 will automatically close the dropdown when an element is selected,
|
||||
similar to what is done with a normal select box. This behavior can be
|
||||
changed though to keep the dropdown open when results are selected,
|
||||
allowing for multiple options to be selected quickly.
|
||||
</p>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
<dl class="dl-horizontal">
|
||||
<dt>Key</dt>
|
||||
<dd><code>closeOnSelect</code></dd>
|
||||
|
||||
<dt>Default</dt>
|
||||
<dd><code>true</code></dd>
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-6">
|
||||
<dl class="dl-horizontal">
|
||||
<dt>Adapter</dt>
|
||||
<dd>
|
||||
<code title="select2/dropdown">DropdownAdapter</code>
|
||||
</dd>
|
||||
|
||||
<dt>Decorator</dt>
|
||||
<dd>
|
||||
<code title="select2/dropdown/closeOnSelect">CloseOnSelect</code>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p>
|
||||
If this decorator is not used (or <code>closeOnSelect</code> is set to
|
||||
<code>false</code>), the dropdown will not automatically close when a
|
||||
result is selected. The dropdown will also never close if the
|
||||
<kbd>ctrl</kbd> key is held down when the result is selected.
|
||||
</p>
|
||||
</section>
|
||||
|
@ -1,50 +1,50 @@
|
||||
<section id="events">
|
||||
<div class="page-header">
|
||||
<h1>Events</h1>
|
||||
</div>
|
||||
<section>
|
||||
<div id="events" class="page-header">
|
||||
<h1>Events</h1>
|
||||
</div>
|
||||
|
||||
<p>
|
||||
Select2 has an internal event system that is used to notify parts of the
|
||||
component that state has changed, as well as an adapter that allows some
|
||||
of these events to be relayed to the outside word.
|
||||
</p>
|
||||
<p>
|
||||
Select2 has an internal event system that is used to notify parts of the
|
||||
component that state has changed, as well as an adapter that allows some
|
||||
of these events to be relayed to the outside word.
|
||||
</p>
|
||||
|
||||
<dl class="dl-horizontal">
|
||||
<dt>Adapter</dt>
|
||||
<dd>
|
||||
<code title="select2/selection">SelectionAdapter</code>
|
||||
</dd>
|
||||
<dl class="dl-horizontal">
|
||||
<dt>Adapter</dt>
|
||||
<dd>
|
||||
<code title="select2/selection">SelectionAdapter</code>
|
||||
</dd>
|
||||
|
||||
<dt>Decorator</dt>
|
||||
<dd>
|
||||
<code title="select2/selection/eventRelay">EventRelay</code>
|
||||
</dd>
|
||||
</dl>
|
||||
<dt>Decorator</dt>
|
||||
<dd>
|
||||
<code title="select2/selection/eventRelay">EventRelay</code>
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
<h2 id="events-public">
|
||||
Public events
|
||||
</h2>
|
||||
<h2 id="events-public">
|
||||
Public events
|
||||
</h2>
|
||||
|
||||
<p>
|
||||
All public events are relayed using the jQuery event system, and they are
|
||||
triggered on the <code><select></code> element that Select2 is
|
||||
attached to. You can attach to them using the
|
||||
<a href="https://api.jquery.com/on/"><code>.on</code> method</a> provided
|
||||
by jQuery.
|
||||
</p>
|
||||
<p>
|
||||
All public events are relayed using the jQuery event system, and they are
|
||||
triggered on the <code><select></code> element that Select2 is
|
||||
attached to. You can attach to them using the
|
||||
<a href="https://api.jquery.com/on/"><code>.on</code> method</a> provided
|
||||
by jQuery.
|
||||
</p>
|
||||
|
||||
<h2 id="events-internal">
|
||||
Internal events
|
||||
</h2>
|
||||
<h2 id="events-internal">
|
||||
Internal events
|
||||
</h2>
|
||||
|
||||
<p>
|
||||
Select2 triggers internal events using its own internal event system,
|
||||
which allows adapters to communicate with each other. These events are not
|
||||
accessible through the jQuery event system.
|
||||
</p>
|
||||
<p>
|
||||
Select2 triggers internal events using its own internal event system,
|
||||
which allows adapters to communicate with each other. These events are not
|
||||
accessible through the jQuery event system.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
You can find more information on the public events triggered by individual
|
||||
adapters in <a href="#adapters">the individual adapter documentation</a>.
|
||||
</p>
|
||||
</section>
|
||||
<p>
|
||||
You can find more information on the public events triggered by individual
|
||||
adapters in <a href="#adapters">the individual adapter documentation</a>.
|
||||
</p>
|
||||
</section>
|
||||
|
Loading…
Reference in New Issue
Block a user