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

Don't hide dropdown after selection on a multiple select #2310

Closed
jnsandrew opened this issue Apr 10, 2015 · 7 comments
Closed

Don't hide dropdown after selection on a multiple select #2310

jnsandrew opened this issue Apr 10, 2015 · 7 comments

Comments

@jnsandrew
Copy link

I couldn't see an option for this, and I didn't have much luck using the events / triggers either, but is it possible to not hide the dropdown after choosing an option. I currently have a multiple select with a lot of options, and it's painful to open the dropdown after a selection and scroll the whole way down again.

Similar to #21 - but for me holding CMD doesn't keep the dropdown open.

@qwelyt
Copy link

qwelyt commented Apr 13, 2015

Care to post a jfiddle with an example and some info on your browser?
I'm unable to reproduce the behaviour. Ctrl+Click keeps the options open for me.

@ghost
Copy link

ghost commented Apr 15, 2015

this was posted on stackexchange, and works like a charm:

var chosen = $('.yourChosenclass').chosen().data('chosen');
    var autoClose = false;
    var chosen_resultSelect_fn = chosen.result_select;
    chosen.search_contains = true;
    chosen.result_select = function(evt) 
    {
    var resultHighlight = null;
    if(autoClose === false)
    {
        evt['metaKey'] = true;
        evt['ctrlKey'] = true;
        resultHighlight = chosen.result_highlight;
    }
    var stext = chosen.get_search_text();
    var result = chosen_resultSelect_fn.call(chosen, evt);
    if(autoClose === false && resultHighlight !== null)
        resultHighlight.addClass('result-selected');

    this.search_field.val(stext);               
    this.winnow_results();
    this.search_field_scale();

    return result;
 };

@jnsandrew
Copy link
Author

Thanks for the response - just an update, I'm stuck on other projects at the moment for another week probably so can't try this until I'm back in the office.

@periyasamy25
Copy link

I need the following for my dropdown.
1.Don't hide dropdown after selection on a multiple select
2.If i cilck the value it should be selected and if i click again it should be unselected and also don't want to hide dropdown.
3.hide dropdown when i click outside the dropdown
i don't need ctrl+click simply need click with multiple selection and deselection.
help me

@BarisW
Copy link

BarisW commented Aug 7, 2015

Thanks @ondefar. I used you code to fix my issue. Works great, thanks for sharing!

@tjschuck
Copy link
Member

Thanks to everyone here for your workarounds. This issue is a duplicate of #1546, though, so I'm closing this one in favor of that one. Please leave any additional feedback you may have there.

Thanks again!

@chaitanya-nyros
Copy link

@ondefar Works like a charm 👍

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

6 participants