File tree Expand file tree Collapse file tree
docs/_includes/options/dropdown Expand file tree Collapse file tree Original file line number Diff line number Diff line change 77 Can Select2 wait until the user has typed a search term before triggering the request?
88 </ h3 >
99
10+ < pre class ="prettyprint ">
11+ $('select').select2({
12+ ajax: {
13+ delay: 250 // wait 250 milliseconds before triggering the request
14+ }
15+ });
16+ </ pre >
17+
1018 {% include options/not-written.html %}
1119
1220 < h3 >
1321 Select2 is allowing long search terms, can this be prevented?
1422 </ h3 >
1523
24+ < pre class ="prettyprint ">
25+ $('select').select2({
26+ maximumInputLength: 20 // only allow terms up to 20 characters long
27+ });
28+ </ pre >
29+
1630 {% include options/not-written.html %}
1731
1832 < h3 >
1933 I only want the search box if there are enough results
2034 </ h3 >
2135
36+ < pre class ="prettyprint ">
37+ $('select').select2({
38+ minimumResultsForSearch: 20 // at least 20 results must be displayed
39+ });
40+ </ pre >
41+
42+ {% include options/not-written.html %}
43+
44+ < h3 >
45+ How can I permanently hide the search box?
46+ </ h3 >
47+
48+ < pre class ="prettyprint ">
49+ $('select').select2({
50+ minimumResultsForSearch: Infinity
51+ });
52+ </ pre >
53+
2254 {% include options/not-written.html %}
2355</ section >
Original file line number Diff line number Diff line change @@ -13,6 +13,12 @@ <h3 id="dropdownParent">
1313 Can I pick an element for the dropdown to be appended to?
1414 </ h3 >
1515
16+ < pre class ="prettyprint ">
17+ $('select').select2({
18+ dropdownParent: $('#my_amazing_modal')
19+ });
20+ </ pre >
21+
1622 {% include options/not-written.html %}
1723
1824 < h3 >
Original file line number Diff line number Diff line change 77 Can I select the highlighted result when the dropdown is closed?
88 </ h3 >
99
10+ < pre class ="prettyprint ">
11+ $('select').select2({
12+ selectOnClose: true
13+ });
14+ </ pre >
15+
1016 {% include options/not-written.html %}
1117
1218 < h3 >
1319 Can I prevent the dropdown from closing when a result is selected?
1420 </ h3 >
1521
22+ < pre class ="prettyprint ">
23+ $('select').select2({
24+ closeOnSelect: false
25+ });
26+ </ pre >
27+
1628 {% include options/not-written.html %}
1729</ section >
You can’t perform that action at this time.
0 commit comments