if(interactive()){
library(shinymaterial)
library(shinyjs)
ui <- material_page(
useShinyjs(),
material_dropdown("dropdown1",
label = "dropdown1",
choices = c("a","b","c","d"),
multiple = TRUE),
material_dropdown("dropdown2",
label = "dropdown2",
choices = c("a","b","c","d"),
multiple =TRUE)
)
server <- function(input, output, session){
reactives <- reactiveValues(
val = list()
)
observe({
reactives$val$choices <- input$dropdown1
reactives$val$values <- input$dropdown2
}, priority = 1)
observe({
message("this")
message(length(input$dropdown2))
message((input$dropdown2))
if(!is.null(reactives$val$values)){
if(length(input$dropdown2) ==2){
#browser()
}
}
update_material_dropdown(session,
input_id = "dropdown2",
choices = reactives$val$choices,
value = reactives$val$values,
multiple = TRUE)
})
}
shinyApp(ui, server)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.