Open relikd opened 1 year ago
Yup, this is a feature request. Here's a quick explanation of why we can't universally do this.
minimumInputLength
tells Select2 to not kick off a query for results unless X number of characters are present in the search box. minimumResultsForSearch
tells Select2 to show or hide the search box based on the number of results that come back in a query. Because minimumInputLength
does not kick off a query unless there are characters present, minimumResultsForSearch
does not know how many results are present and therefore it cannot determine if the search box needs to be displayed.
I'm pretty sure the only time when we could allow them to be combined is when we can run a blank search to get the first page of results, which basically means only standard <select>
use cases (maybe with array loading as well), definitely not with AJAX and definitely not with custom result handlers. If you're able to work through that challenge, I'll definitely entertain a pull request for handling this edge case.
Ahh, I see the problem. Yes, in my case it would indeed be a local search on select options. Unfortunatelly I dont have the time to look into this. As a workaround I just disable the minLength requirement ^.^
This is a bug in my opinion but would qualify as a feature request.
Given the example below, with a dataset of 4 entries, I would expect that select2 will show the entire list instead of a message prompt to enter at least 1 character. After all, the search bar should be hidden before it checks for user input.