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

verbiage describe how to use id property with ajax calls.

In reference to issue #852
This commit is contained in:
Daniel Pollock 2013-11-12 12:40:23 -06:00
parent 9d9aa731ec
commit 9f18685cb2

View File

@ -558,6 +558,12 @@ $("#e19").select2({ maximumSelectionSize: 3 });
<h3>Example Code</h3> <h3>Example Code</h3>
<pre class="prettyprint linenums" id="code_e6"></pre> <pre class="prettyprint linenums" id="code_e6"></pre>
<p>Select2 uses jQuery's <code>$.ajax</code> function to execute the remote call by default. An alternative <code>transport</code> function can be specified in the ajax settings, or an entirely custom implementation can be built by providing a custom <code>query</code> function instead of using the <code>ajax</code> helper.</p> <p>Select2 uses jQuery's <code>$.ajax</code> function to execute the remote call by default. An alternative <code>transport</code> function can be specified in the ajax settings, or an entirely custom implementation can be built by providing a custom <code>query</code> function instead of using the <code>ajax</code> helper.</p>
<p>Select2 requires an id property to be set for items returned in the <code>results</code> parameter. If your result doesn't have an 'id' property then you can specify it in the <code>id</code> parameter of select2. For example:
<code>
id: function(object) {
return object.text;
}</code> will use the text property as the id.
</p>
</div> </div>
</article> </article>
<article class="row" id="infinite"> <article class="row" id="infinite">