Skip to content
  • Does this work? I.e. change the URL and get the changes

    enableBookmarking("url")
    
    sources <- c("ECDC", "JHU", "JHU_US")
    
    get_countries <- function(source = "ECDC") {
      switch(source,
             "ECDC" = c("Spain", "Switzerland"),
             "JHU" = c("USA", "Australia"),
             "JHU_US" = c("Alabama", "Florida"))
    }
    
    shinyApp(
      
      ui = function(req) {
        fluidPage(
          textInput("txt", "Text"),
          checkboxInput("chk", "Checkbox"),
          selectInput("source", "Choose a data source:",
                      sources),
          uiOutput("country_input")
        )
      },
      server = function(input, output, session) {
        
        output$country_input <- renderUI({
          selectInput("country_output", "Choose a country or region:",
                      # selected = "Switzerland",
                      get_countries(input$source))
        })
        
        observe({
          # Trigger this observer every time an input changes
          reactiveValuesToList(input)
          session$doBookmark()
        })
        
        onBookmarked(function(url) {
          updateQueryString(url)
        })
        
      }
    )
    
    
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment