-
Notifications
You must be signed in to change notification settings - Fork 97
/
Copy pathapp.R
26 lines (20 loc) · 821 Bytes
/
app.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
library(shiny)
library(shiny.semantic)
ui <- semanticPage(
title = "Dropdown example",
dropdown_input("simple_dropdown", LETTERS[1:5], value = "A", type = "search selection multiple"),
p("Selected letter:"),
textOutput("selected_letter"),
actionButton("simple_button", "Update input to D"),
actionButton("simple_button2", "Update input to use all letters")
)
server <- shinyServer(function(input, output, session) {
output$selected_letter <- renderText(paste(input[["simple_dropdown"]], collapse = ", "))
observeEvent(input$simple_button, {
update_dropdown_input(session, "simple_dropdown", value = "D")
})
observeEvent(input$simple_button2, {
update_dropdown_input(session, "simple_dropdown", choices = LETTERS, value = input$simple_dropdown)
})
})
shinyApp(ui = ui, server = server)