1
0
mirror of synced 2024-11-22 13:06:08 +03:00

Merge branch 'docs-for-ajax-results-looks-like' of https://github.com/sedrubal/select2

This commit is contained in:
alexweissman 2017-08-31 17:30:22 -04:00
commit f13ea6f5ff

View File

@ -19,7 +19,17 @@
What should the results returned to Select2 look like?
</h3>
{% include options/not-written.html %}
<p>
When you aren't using custom formatting functions (<code>templateResult</code> and <code>templateSelection</code> or <code>formatResults</code>) the data returned by the data provider or by <code>processResults</code> should be a list of objects. The objects should contain an <code>id</code> and a <code>text</code> property. The text property will be displayed. See <a href="#what-properties-are-required-on-the-objects-passed-in-to-the-ar">What properties are required on the objects passed in to the array?</a>.
</p>
{% highlight js linenos %}
[
{id: 'id1', text: 'option1'},
{id: 'id2', text: 'option2'},
{id: 'id3', text: 'option3'},
]
{% endhighlight %}
<h3>
Is there a way to modify the response before passing it back to Select2?