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

Can it be made typeahead instead of dropdown? #24

Open
Diparati opened this issue Jan 28, 2019 · 4 comments
Open

Can it be made typeahead instead of dropdown? #24

Diparati opened this issue Jan 28, 2019 · 4 comments

Comments

@Diparati
Copy link

Similar to the previous select2 multiple, can this multiple checkboxes be made typeahead too?

What I mean is the user types for the value, gets it, checks it, clicks outside, the label shows "1 selected". If instead of clicking outside, he backspaces and types another, gets it, checks it, clicks outside, the label shows "2 selected". Something like this.

So if you refer, https://jsfiddle.net/wasikuss/7ak9skbb/, I guess I am asking if the 2nd and 3rd select box functionalities can be combined?

@jamezrgomez
Copy link

jamezrgomez commented Aug 1, 2019

+1

@wasikuss
Copy link
Owner

wasikuss commented Sep 22, 2019

add minimumResultsForSearch: 0 then you can search for items.
https://select2.org/searching#limiting-display-of-the-search-box-to-large-result-sets - for meaning of this option.

https://jsfiddle.net/04mar3z9/ - here you can check how it works

@wasikuss wasikuss pinned this issue Sep 22, 2019
@wasikuss wasikuss unpinned this issue Sep 22, 2019
@evlo
Copy link

evlo commented Nov 25, 2019

well, using that selection does not work, at least for me :)

@kensta kensta mentioned this issue Apr 22, 2021
@nickl-
Copy link

nickl- commented Jul 20, 2021

well, using that selection does not work, at least for me :)

If you place minimumResultsForSearch before templateSelection it works as expected.

$('.select2-multiple2').select2MultiCheckboxes({
    minimumResultsForSearch: 0,
    templateSelection: function(selected, total) {
      return "Selected " + selected.length + " of " + total;
    }
});

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

No branches or pull requests

5 participants