chosen
chosen copied to clipboard
chosen:update is cleaning search input
Steps to reproduce
- Type something into the search input;
- Modify the select contents;
- Trigger "chosen:updated" event;
- 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.
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.
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.
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