diff --git a/docs/_includes/options/dropdown/filtering.html b/docs/_includes/options/dropdown/filtering.html index 054ec19d..9a05511a 100644 --- a/docs/_includes/options/dropdown/filtering.html +++ b/docs/_includes/options/dropdown/filtering.html @@ -7,17 +7,49 @@ Can Select2 wait until the user has typed a search term before triggering the request? +
+$('select').select2({
+  ajax: {
+    delay: 250 // wait 250 milliseconds before triggering the request
+  }
+});
+
+ {% include options/not-written.html %}

Select2 is allowing long search terms, can this be prevented?

+
+$('select').select2({
+  maximumInputLength: 20 // only allow terms up to 20 characters long
+});
+
+ {% include options/not-written.html %}

I only want the search box if there are enough results

+
+$('select').select2({
+  minimumResultsForSearch: 20 // at least 20 results must be displayed
+});
+
+ + {% include options/not-written.html %} + +

+ How can I permanently hide the search box? +

+ +
+$('select').select2({
+  minimumResultsForSearch: Infinity
+});
+
+ {% include options/not-written.html %} \ No newline at end of file diff --git a/docs/_includes/options/dropdown/placement.html b/docs/_includes/options/dropdown/placement.html index 67c986c7..1962b49b 100644 --- a/docs/_includes/options/dropdown/placement.html +++ b/docs/_includes/options/dropdown/placement.html @@ -13,6 +13,12 @@ Can I pick an element for the dropdown to be appended to? +
+$('select').select2({
+  dropdownParent: $('#my_amazing_modal')
+});
+
+ {% include options/not-written.html %}

diff --git a/docs/_includes/options/dropdown/selections.html b/docs/_includes/options/dropdown/selections.html index bcaf0370..c51b6662 100644 --- a/docs/_includes/options/dropdown/selections.html +++ b/docs/_includes/options/dropdown/selections.html @@ -7,11 +7,23 @@ Can I select the highlighted result when the dropdown is closed?

+
+$('select').select2({
+  selectOnClose: true
+});
+
+ {% include options/not-written.html %}

Can I prevent the dropdown from closing when a result is selected?

+
+$('select').select2({
+  closeOnSelect: false
+});
+
+ {% include options/not-written.html %} \ No newline at end of file