I am trying to parse the url as per the selection in the dropdown.
Now when we 127.0.0.1:XXXX/?selected_facility=4 in the url, it is working fine.
But can we do a small change here. Whenever the user changes the dropdown, the url itself should be get changed to respective once
For example,
When user selects 4, the url should become 127.0.0.1:XXXX/?selected_facility=4
Similarly, 5, the url should become 127.0.0.1:XXXX/?selected_facility=5
Right now, the url is not getting changed
library(shiny)
facilities <- seq(1:5)
ui <- fluidPage(
selectInput("selected_facility", "Select facility", choices = facilities)
)
server <- function(input, output, session) {
observe({
#Get URL query
query <- parseQueryString(session$clientData$url_search)
#Ignore if the URL query is null
if (!is.null(query[['selected_facility']])) {
#Update the select input
updateSelectInput(session, "selected_facility", selected = query[['selected_facility']], choices = facilities)
}
})
}
shinyApp(ui, server)