1
0
mirror of synced 2025-02-04 06:09:23 +03:00

catch up to master

This commit is contained in:
Igor Vaynberg 2012-06-27 21:49:39 -07:00
parent 5a69e1396f
commit 250885d789
3 changed files with 16 additions and 14 deletions

3
.gitignore vendored
View File

@ -2,3 +2,6 @@
.DS_Store
select2wip
_site
.project
.classpath
.settings

View File

@ -943,24 +943,23 @@ $("#e17").select2({
<p>
Essentially this is an <code>id->object</code> mapping function.
</p>
<pre>initSelection(element)</pre>
<pre>initSelection(element, callback)</pre>
<table class="table table-bordered table-striped">
<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>&lt;returns&gt;</td><td>object or array of objects</td><td><code>Object</code> representing the choice
to be selected, or an <code>array</code> of such objects in case Select2 is in multi mode.</td></tr>
<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>
</table>
<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
the text:
<pre class="prettyprint">
$("#tags").select2({
initSelection : function (element) {
initSelection : function (element, callback) {
var data = [];
$(element.val().split(",")).each(function () {
data.push({id: this, text: this});
});
return data;
callback(data);
}
});
</pre>

@ -1 +1 @@
Subproject commit 7ec2dec955e7b4065777cc3278e9e95fad7ea2bf
Subproject commit 45442aa8d7a4aabb62733f22d28ec0a72cee786f