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

clear() API method does not restore the option list #438

Closed
nlwillia opened this issue May 23, 2014 · 1 comment
Closed

clear() API method does not restore the option list #438

nlwillia opened this issue May 23, 2014 · 1 comment
Labels

Comments

@nlwillia
Copy link

I noticed this when I ran into problems with the setValue(items) API method.

If I select an item and then use setValue to select a different item, the originally selected item does not appear as an option even though it should no longer be selected. Or if I select all items and then setValue([]), there are no options to choose.

setValue calls clear() which should be resetting the selected state of options in the option list, but this isn't happening. As a result, you get an option list that shrinks until something else forces it to rebuild.

I've found that I can work around this problem by calling refreshItems() after calling setValue, but this really shouldn't be necessary. Here's a demo of the problem in action.

http://plnkr.co/edit/iZhwwd6COtecyA8ZMJsi?p=preview

@brianreavis
Copy link
Member

Thanks for pointing this out. This is now fixed in v0.10.0 and above.

scarfacedeb pushed a commit to scarfacedeb/selectize.js that referenced this issue Aug 27, 2014
* upstream/master: (69 commits)
  Released 0.11.0.
  Added "allowEmptyOption" option (selectize#163).
  Fixed broken bootstrap3 build.
  Fixing confusing description
  renamed the undefined plugins variable to selector_plugins
  Released 0.10.1.
  Bind createFilter callback to Selectize instance.
  Released 0.10.0.
  Calculate scrollbar width (fixes selectize#360).
  Fix for selectize#438 + tests.
  Added createFilter sample to contacts demo.
  Cherry picked commit 6e04d7b from selectize#370.
  Minor cleanup of selectize#405.
  Forgot self qualifier on
  Jquery cached data allocated by selectized is now cleaned up at destroy time
  Removing extra tabs
  selectized class should not have been added before the classes were checked and propegated to all of the controls created by selectize.  It was previously added after this initialization and is now also added at the same time.
  Used method call to isFull to avoid duplicate code
  Consolidated the refreshState call to capture just becoming full during bulk (or any) addItem call
  Delaying updating attributes and caret during bulk insertion
  ...

Conflicts:
	src/selectize.js
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