Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conflict with minimumResultsForSearch and tags init options #6250

Open
andregreeff opened this issue May 11, 2023 · 1 comment
Open

Conflict with minimumResultsForSearch and tags init options #6250

andregreeff opened this issue May 11, 2023 · 1 comment

Comments

@andregreeff
Copy link

andregreeff commented May 11, 2023

I have found that the "Dynamic Option Creation" feature breaks a little with a custom minimum result count applied to the "list search" feature.

I don't have a JSBin account, but I did verify this by setting these options in the template linked in the new issue text.

this can be reproduced with the following settings:

$('#example1').select2({
  minimumResultsForSearch: 2,
  tags: true
});

I personally discovered this after bashing my head again the proverbial wall for 2 hours trying to work out why tags: true was doing absolutely nothing to my Select2 instance... only to discover that the project I'm working in sets minimumResultsForSearch: 5 in the global defaults.

so as a fix, might I suggest simply overriding or ignore the minimumResultsForSearch property for instances that use tags? it will only save one config setting in some cases, but it should help prevent a great many headaches.

@kevin-brown
Copy link
Member

I would tend to agree with you that there are no situations where having tags enabled while having a minimum number of results for the search makes sense, so I've accepted this and marked it as a documentation fix. It would also make sense to raise a debug warning for any configuration where we detect these two being used together.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants