juba / shinyglide

Glide.js component for Shiny apps
https://juba.github.io/shinyglide/
91 stars 8 forks source link

How to access the input of a previous screen? #11

Closed AlbertoAlmuinha closed 4 years ago

AlbertoAlmuinha commented 4 years ago

Hello,

I would like to be able to use the selected value in a slider of a previous screen as a parameter of a successive screen ... is this possible?

For example, in the following case that I copy, I would like the second screen to be able to use in the argument 'min' the value retrieved in 'mean_modal'. I am using this modal on the server because it is activated when an actionButton is pressed (in case this influences).

Here the example:

glide_modal <- modalDialog( title = "Startup assistant", easyClose = FALSE, footer = NULL, glide( custom_controls = modal_controls, screen( p("First, please select a mean value"), numericInput("mean_modal", "Mean", value = 0) ), screen( p("Next, please select a standard deviation value"), numericInput("sd_modal", "Standard deviation", value = 1, min = input$mean_modal) ) ) )

Thank you very much in advance!

juba commented 4 years ago

To do this you must use an uiOutput to generate your second numericInput, which would then be able to use input$mean_modal.

See here for more info :

https://shiny.rstudio.com/articles/dynamic-ui.html

AlbertoAlmuinha commented 4 years ago

Thank you very much for your quick response. I have solved the problem by adding the renderUI function inside the second screen before the slider.

Great package! Greetings!