-
-
Notifications
You must be signed in to change notification settings - Fork 532
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
ObjectSelector/DiscreteSlider should handle empty/length-one object lists gracefully #361
Comments
It sounds like Panel should handle the case containing zero or one numeric value, for which we can simply show a static text widget, with no slider needed (@philippjfr?). As for avoiding switching widget types, you can simply specify the widget type at the Panel level for that parameter, overriding the default logic, but I don't recall the syntax for that; I think it's somewhere in the docs, though. |
Yes, that seems like the appropriate behavior, although I wish sliders at least didn't error when start and end are the same. |
I also think defaulting to |
If you want a DiscreteSlider you'll still be able to be explicit about it, but I think by default making the fewest assumptions is best. |
Ok, sounds good. A little less magic... |
param.ObjectSelector
turns into aDiscreteSlider
instead of aSelect
when displayed as a widget only if it is initialized with objects containing numerical values. In particular, this leads to two unexpected behaviors:ObjectSelector
cannot be initialized with objects lists containing zero or one numeric value (they can be initialized with zero or one non-numeric value).ObjectSelector
is initialized with all numeric values, this produces a different widget than what you see if its initialized with non-numeric values.Motivation: In cases where the list of options is known ahead of time and fixed at runtime, this is fine. But I'm using
ObjectSelectors
to filter on columns of a datasource; this means that whether I get aDiscreteSlider
or aSelect
is determined by the properties of my data in an unexpected way. Worse, my app may error out or not (because of an empty list or singleton list of objects) depending on this initial condition.Possible resolutions to the empty/singleton objects issue:
Possible resolutions to the indeterminacy issue:
NumericSelector
type to param (which is displayed as a slider) and makeparam.ObjectSelector
always show aSelect
widget.Thoughts?
Example:
Full traceback:
The text was updated successfully, but these errors were encountered: