-
Notifications
You must be signed in to change notification settings - Fork 949
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
Fix _SelectionModel and _MultipleSelectionModel to sync using indices #1262
Conversation
If we sync label too, that would be useful in some cases, what do you think? |
This was also causing issues, due to this apparent bug that was invoking validation more times than expected: ipython/traitlets#390.
@maartenbreddels, can you give this a try and see how it works?
Possibly, though I don't like having two possibly conflicting sources of truth in the protocol, and it becomes confusing on who sets it (frontend or backend? Both I think have a valid usecase). |
Make selection slider have a nonempty selection.
I'd much rather have the label derived from the index independently on the frontend and backend. |
Two design decisions: (a) in this implementation, the default selection is no selection (except for the selection slider, which must have something selected (b) We always coerce the options list to a Thoughts? |
We can still explicitly select no entry by having an empty options list or by explicitly setting the index, value, or label to None.
I went ahead and changed this to always select the first item (if there is a first item) on initialization or when changing the options. That seems to work better with interact, for example, where you just want some value by default. However, I left the multiple select to still unselect all items when changing the options or setting it initially. Thoughts? |
(This is a change - before, if the options changed in a multiple select, it would try to match up the previous selected labels to attempt to select the same items after the change. I think that is very error-prone.) |
Merging...let's iterate in another PR. |
Fixes #1091
CC @maartenbreddels