todc / todc-select2

Google-themed fork of Select2. Select2 is a jQuery based replacement for select boxes. It supports searching, remote data sets, and infinite scrolling of results.
http://todc.github.com/todc-select2/
Other
112 stars 17 forks source link

Disable search box? #4

Closed ryanmortier closed 11 years ago

ryanmortier commented 11 years ago

Is there a way to use the basic styling without the search box?

todc commented 11 years ago

You can specify a number for the minimumResultsForSearch option:

The minimum number of results that must be initially (after opening the dropdown for the first time) populated in order to keep the search field. This is useful for cases where local data is used with just a few results, in which case the search box is not very useful and wastes screen space.

For example:

$("#e2").select2({
    minimumResultsForSearch: 99
});
ryanmortier commented 11 years ago

Oh sorry, I misread that option. Thank you!

Muyv commented 10 years ago

Thanks

m98proxy commented 8 years ago

Only for record, set minimumResultsForSearch to 99 really does not solve the problem, the search box will be back if size of drop down itens were greater than 99

The correct code is:

$("#e2").select2({ minimumResultsForSearch: Infinity });

http://www.w3schools.com/jsref/jsref_infinity.asp