catch up to master
This commit is contained in:
parent
5a69e1396f
commit
250885d789
3
.gitignore
vendored
3
.gitignore
vendored
@ -2,3 +2,6 @@
|
|||||||
.DS_Store
|
.DS_Store
|
||||||
select2wip
|
select2wip
|
||||||
_site
|
_site
|
||||||
|
.project
|
||||||
|
.classpath
|
||||||
|
.settings
|
||||||
|
@ -943,24 +943,23 @@ $("#e17").select2({
|
|||||||
<p>
|
<p>
|
||||||
Essentially this is an <code>id->object</code> mapping function.
|
Essentially this is an <code>id->object</code> mapping function.
|
||||||
</p>
|
</p>
|
||||||
<pre>initSelection(element)</pre>
|
<pre>initSelection(element, callback)</pre>
|
||||||
<table class="table table-bordered table-striped">
|
<table class="table table-bordered table-striped">
|
||||||
<tr><th>Parameter</th><th>Type</th><th>Description</th></tr>
|
<tr><th>Parameter</th><th>Type</th><th>Description</th></tr>
|
||||||
<tr><td>element</td><td>jQuery array</td><td>element Select2 is attached to</td></tr>
|
<tr><td>element</td><td>jQuery array</td><td>element Select2 is attached to</td></tr>
|
||||||
<tr><td><returns></td><td>object or array of objects</td><td><code>Object</code> representing the choice
|
<tr><td>callback</td><td>function</td><td>callback function that should be called with the data which is either an object in case of a single select or an array of objects in case of multi-select</td></tr>
|
||||||
to be selected, or an <code>array</code> of such objects in case Select2 is in multi mode.</td></tr>
|
|
||||||
</table>
|
</table>
|
||||||
<p class="alert alert-info">This function will only be called when there is initial input to be processed.</p>
|
<p class="alert alert-info">This function will only be called when there is initial input to be processed.</p>
|
||||||
Here is an example implementation used for tags. Tags are the simplest form of data where the id is also
|
Here is an example implementation used for tags. Tags are the simplest form of data where the id is also
|
||||||
the text:
|
the text:
|
||||||
<pre class="prettyprint">
|
<pre class="prettyprint">
|
||||||
$("#tags").select2({
|
$("#tags").select2({
|
||||||
initSelection : function (element) {
|
initSelection : function (element, callback) {
|
||||||
var data = [];
|
var data = [];
|
||||||
$(element.val().split(",")).each(function () {
|
$(element.val().split(",")).each(function () {
|
||||||
data.push({id: this, text: this});
|
data.push({id: this, text: this});
|
||||||
});
|
});
|
||||||
return data;
|
callback(data);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
</pre>
|
</pre>
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit 7ec2dec955e7b4065777cc3278e9e95fad7ea2bf
|
Subproject commit 45442aa8d7a4aabb62733f22d28ec0a72cee786f
|
Loading…
x
Reference in New Issue
Block a user