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

"force" param doesn't work #14

Open
twiginteractive opened this issue Apr 18, 2017 · 1 comment
Open

"force" param doesn't work #14

twiginteractive opened this issue Apr 18, 2017 · 1 comment
Labels

Comments

@twiginteractive
Copy link

Hi -

Great little plugin extension to Chosen, even seems to work fine with latest version (1.7.0). Only issue I found is that despite setting the "force" param to true, I still get the error:

ChosenOrder::setSelectionOrder: ignoring option '1370' which is not selected. Set optional parameter "force" to 'true' to get the ordered selection forced first.

I've tried with a simple array of values - same result. Any ideas? I'm calling the setSelectionOrder( order, true ) call from the chosen:ready callback.

@tristanjahier
Copy link
Owner

tristanjahier commented Apr 30, 2017

Hi @twiginteractive,

I've just tested out with Chosen 1.7.0, but I was unable to reproduce this issue.
Can you please tell me which flavor of Chosen you are using? I mean jQuery or Prototype? And which version of the framework?

Feel free to fork/edit this fiddle to reflect your problem: http://jsfiddle.net/y10od1rc/

You possibly have a race condition, which a setTimeout could solve:

$('#my-select').on('chosen:ready', function () {
    setTimeout(function () {
        $('#my-select').setSelectionOrder(['banane'], true);        
    }, 0);
});

Please tell me if that workaround works for you. ;-)

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

No branches or pull requests

2 participants