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

Hook refreshOptions instead of onFocus #5

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

mcavalletto
Copy link

Selectize.js refreshes the DOM list of clickable options frequently,
such as after any option is selected, and when the user types to filter
the list of options.

The plugin needs to reapply the disabled class after every one of those
events, which it can do by running its extra code after every call to
refreshOptions.

Fixes #3.

Selectize.js refreshes the DOM list of clickable options frequently,
such as after any option is selected, and when the user types to filter
the list of options.

The plugin needs to reapply the disabled class after every one of those
events, which it can do by running its extra code after every call to
refreshOptions.

Fixes mondorobot#3.
Matthew Simon Ryan Cavalletto added 3 commits February 12, 2017 19:15
The plugin's definition of onOptionSelect only needs to provide the new
behavior for handling disabled options, and should fall through to the
underlying implementation for the create/select choices rather than
copy-and-pasting that code into the plugin.

This is important so that when fixes are made in Selectize.js they don't
need to be replicated here.
The initial version of this plugin only allowed disabled options to be
set when a Selectize instance was created, but in some circumstances you
may need to disable choices on the fly.

This change adds four new methods to the API to allow this:
- disableOptions(values): Add the provided values to the disabled list.
- enableOptions(values): Remove the provided values to the disabled list.
- setDisabledOptions(values): Make the provided values the only ones disabled.
- disabledOptions(): Retrieve an array of the disabled options.

This is similar to @ghost/734537b6947a1b85ac07ec934a749b4d4d43fa35 but
just contains new methods without overwriting any of the original module.

Fixes mondorobot#2.
Disabled options shouldn't be highlighted the same way as regular
options when made active by mouseover or arrow-key selection.
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

Successfully merging this pull request may close these issues.

1 participant