Skip to content

Commit 3783354

Browse files
committed
Add documentation on ids needing to be strings
This closes select2#4052 This closes select2#4076 This closes select2#4227
1 parent 72d905f commit 3783354

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

docs/_includes/options/data/array.html

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,26 @@ <h3>
3333
included on the data objects that Select2 exposes.
3434
</p>
3535

36+
<h3>
37+
Do the <code>id</code> properties have to be strings?
38+
</h3>
39+
40+
<p>
41+
Because the <code>value</code> attributes on a <code>&gt;select&lt;</code>
42+
tag must be strings, the <code>id</code> property on the data objects must
43+
also be strings. Select2 will attempt to convert anything that is not a
44+
string to a string, which will work for most situations, but it is
45+
recommended to force all of your ids to strings ahead of time.
46+
</p>
47+
48+
<h3>
49+
I can't select results with blank ids or an id of <code>0</code>!
50+
</h3>
51+
52+
<p>
53+
See <a href="#do-the-id-properties-have-to-be-strings">Do the <code>id</code> properties have to be strings?</a>.
54+
</p>
55+
3656
<h3>
3757
How should nested results be formatted?
3858
</h3>

0 commit comments

Comments
 (0)