Document data object format
So far this just documents how <select> elements have their options converted to a data object.
This commit is contained in:
parent
46ab1ebc8d
commit
bc82856fb6
@ -24,10 +24,34 @@
|
|||||||
</h3>
|
</h3>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
No.
|
No. This is a limitation of the HTML specification and is not a limitation that Select2 can overcome.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<h3>
|
<h3>
|
||||||
How are <code><option></code> and <code><optgroup></code> tags serialized into data objects?
|
How are <code><option></code> and <code><optgroup></code> tags serialized into data objects?
|
||||||
</h3>
|
</h3>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Select2 will convert the <code><option></code> tag into a data object based on the following rules.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<pre class="prettyprint linenums">
|
||||||
|
{
|
||||||
|
"id": "value attribute" || "option text",
|
||||||
|
"text": "label attribute" || "option text",
|
||||||
|
"element": HTMLOptionElement
|
||||||
|
}
|
||||||
|
</pre>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
And <code><optgroup></code> tags will be converted into data objects using the following rules
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<pre class="prettyprint linenums">
|
||||||
|
{
|
||||||
|
"text": "label attribute",
|
||||||
|
"children": [ option data object, ... ],
|
||||||
|
"elment": HTMLOptGroupElement
|
||||||
|
}
|
||||||
|
</pre>
|
||||||
</section>
|
</section>
|
Loading…
Reference in New Issue
Block a user