diff --git a/docs/_includes/navigation.html b/docs/_includes/navigation.html index d17d4688..f62cf9d4 100644 --- a/docs/_includes/navigation.html +++ b/docs/_includes/navigation.html @@ -27,6 +27,11 @@
+var data = $.map([ + { + pk: 1, + word: 'one' + }, + { + pk: 2, + word: 'two' + } +], function (obj) { + obj.id = obj.id || obj.pk; + obj.text = obj.text || obj.word; + + return obj; +}); ++ +
+ This will result in an array of data objects that have the id
+ properties that match the existing pk
properties and
+ text
properties that match the existing word
+ properties.
+
+ The same code that was given above can be used in the
+ processResults
method of an AJAX call to map properties there
+ as well.
- In previous versions of Select2, the default messages provided to users could be localized to fit the language of the website that it was being used on. Select2 only comes with the English language by default, but provides community-contributed translations for many common languages. Many of the formatters have been moved to the language
option and the signatures of the formatters have been changed to handle future additions.
+ In previous versions of Select2, the default messages provided to users
+ could be localized to fit the language of the website that it was being
+ used on. Select2 only comes with the English language by default, but
+ provides
+ community-contributed translations for
+ many common languages. Many of the formatters have been moved to the
+ language
option and the signatures of the formatters have
+ been changed to handle future additions.
- Although it was not documented, a list of possible tags could also be provided using the data-select2-tags
attribute and passing in a JSON-formatted array of objects for tags. As the method for specifying tags has changed in 4.0, you should now provide the array of objects using the data-data
attribute, which maps to the array data option. You should also enable tags by setting data-tags="true"
on the object, to maintain the ability for users to create their own options as well.
+ Although it was not documented, a list of possible tags could also be
+ provided using the data-select2-tags
attribute and passing in
+ a JSON-formatted array of objects for tags. As the method for specifying
+ tags has changed in 4.0, you should now provide the array of objects using
+ the data-data
attribute, which maps to
+ the array data option. You should also
+ enable tags by setting data-tags="true"
on the object, to
+ maintain the ability for users to create their own options as well.
@@ -353,18 +442,22 @@ $("select").select2({
- The val
method has been deprecated and will be removed in
+ The "val"
method has been deprecated and will be removed in
Select2 4.1. The deprecated method no longer includes the
triggerChange
parameter.
- You should directly call val
on the underlying
+ You should directly call .val
on the underlying
<select>
element instead. If you needed the second
parameter (triggerChange
), you should also call
.trigger("change")
on the element.
+$("select").val("1"); // instead of $("select").select2("val", "1"); ++
@@ -374,6 +467,10 @@ $("select").select2({
<select>
element. Support for the old methods will be
completely removed in Select2 4.1.
+$("select").prop("disabled", true); // instead of $("select").enable(false); +diff --git a/docs/options.html b/docs/options.html index 39e213aa..3953da4f 100644 --- a/docs/options.html +++ b/docs/options.html @@ -155,9 +155,9 @@ $("select").select2({
option
in
- single-value select boxes is selected, you must add an empty
+ single-value select boxes is selected, you should add an empty
<option></option>
tag that the placeholder
- should use, or it will not work.
+ should use or it may not work.