You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We have a few cases where outputs can become inputs for example:
Clicking or brushing on a plot
Selecting the row of a data frame
Selecting the point on a map
In all of these cases we implicitly create a new input object by appending some text after the output id, and registering it as an input. So in this example we have an output id plot1 and the input becomes input_plot1_click().
This is a pretty confusing API because it's hard for the user to know that the input exists, and it takes a bit of thinking to see how the id that you assigned to the output turns into the new input method. You also can't inspect the object to see what type of interaction is available, and it's hard to document the ways that outputs can be used as inputs. For example we don't have anything on how to access row selection in https://shiny.posit.co/py/api/ui.output_data_frame.html.
With @schloerke's changes to the rendering classes it seems like we create a class-based interaction to solve this problem, where a plot output would produce a class with click, dbl_click, hover and brush methods. and would be called like this:
I think this is less magical and a lot easier to document. We could have a section of the output documentation which defines the reactive output class and show the user all of the methods. This will be particularly important with some of the datagrid work because we probably want to expose a lot of methods around data frame editing.
The text was updated successfully, but these errors were encountered:
I'm pretty sure we'd want to provide the inputs as attributes on the function decorated by @render.*, which is essentially what I plan on doing for {shinywidgets} (posit-dev/py-shinywidgets#119). So, for example, the API would look something like:
We have a few cases where outputs can become inputs for example:
In all of these cases we implicitly create a new input object by appending some text after the output id, and registering it as an input. So in this example we have an output id
plot1
and the input becomesinput_plot1_click()
.This is a pretty confusing API because it's hard for the user to know that the input exists, and it takes a bit of thinking to see how the id that you assigned to the output turns into the new input method. You also can't inspect the object to see what type of interaction is available, and it's hard to document the ways that outputs can be used as inputs. For example we don't have anything on how to access row selection in https://shiny.posit.co/py/api/ui.output_data_frame.html.
With @schloerke's changes to the rendering classes it seems like we create a class-based interaction to solve this problem, where a plot output would produce a class with
click
,dbl_click
,hover
andbrush
methods. and would be called like this:I think this is less magical and a lot easier to document. We could have a section of the output documentation which defines the reactive output class and show the user all of the methods. This will be particularly important with some of the datagrid work because we probably want to expose a lot of methods around data frame editing.
The text was updated successfully, but these errors were encountered: