chosen icon indicating copy to clipboard operation
chosen copied to clipboard

chosen:update is cleaning search input

Open mauriciogior opened this issue 7 years ago • 3 comments

Steps to reproduce

  1. Type something into the search input;
  2. Modify the select contents;
  3. Trigger "chosen:updated" event;
  4. Search input is cleaned as well (shouldn't);

Expected behavior

Search input should not be cleaned. If it was intended to do so, it should be available another event to trigger that does not clean the search input (really useful for integrations with autocomplete and external sources).

Actual behavior

It cleans the search input.

Environment

  • Chosen Version: 1.4.2

  • jQuery or Prototype Version: 1.8.3

  • Browser and Version: Google Chrome 60

  • OS and Version: macOS Sierra.

Additional information

It should be possible to update the contents of chosen without cleaning the search input.

mauriciogior avatar Sep 28 '17 02:09 mauriciogior

We had the same problem. Might look into a fix later, but we need to know if this is expected behaviour (which means we need another event) or if this should be fixed in this event.

marcdejonge avatar Oct 13 '17 07:10 marcdejonge

I'm having this issue too. If this is the desired behavior for some folks, then maybe it would be good to have chosen:update-options which doesn't rebuild the component, only the options.

thadwoodman avatar Mar 13 '19 16:03 thadwoodman

I am doing some conversion on the search input and sending the new value to the search input. I was having troubles having the search update with the new value. I got it working by "$(".chosen-search-input").trigger("keyup.chosen");" after setting the new input

kman445 avatar Dec 02 '20 14:12 kman445