-
-
Notifications
You must be signed in to change notification settings - Fork 489
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
Add a disabled_options
parameter to a custom Select widget
#3067
Conversation
Codecov Report
@@ Coverage Diff @@
## master #3067 +/- ##
==========================================
+ Coverage 83.42% 83.51% +0.08%
==========================================
Files 190 190
Lines 25134 25282 +148
==========================================
+ Hits 20969 21113 +144
- Misses 4165 4169 +4
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Congrats on your first custom Bokeh model! Only have one comment which is that we use 2-space indentation for TypeScript files. If you could resolve that I'll merge.
@philippjfr I've made the changes you requested. Sorry for the indentation, I had noticed the difference but then forgot about it. VSCode wasn't also playing nicely (which is quite rare), I did set the indentation to be of I noticed that this PR was actually breaking the And made three other changes (plus a few minor ones):
|
This PR adds a
disabled_options
parameter to theSelect
widget which allows to disable some options, which in practice makes them unusable and un-clickable.I've extended the base
Select
widget of Bokeh to implement this option on the client-side. I've called the modelCustomSelect
instead of something more specific, but I'm open for a better name.disabled_options
is a List Parameter (default to[]
) that accepts a subset of theoptions
values, i.e. ifoptions
is a dictionary thendisabled_options
must list some dictionary values, not keys. I've had the feeling this would be more intuitive, but since dictionary options have been confusing people I'd also be fine implementing the "labels" alternative if that's clearer.I've added some validation in a dedicated callback but I observed that it's called after
_process_param_change
which means that the bokeh model and then the UI still gets updated before an error is raised on the Python side. I wasn't sure implementing the validation/error part in_process_param_change
was the right thing to do either.