Updates a shiny input based the type of object x and other arguments.
Value
The result of the following shiny input updates is returned,
based on the type of object passed to x, and other specified arguments.
| Value | x | Arguments |
| shiny::updateDateInput | Date, POSIXt | default |
| shiny::updateDateRangeInput | Date, POSIXt | range = TRUE |
| shiny::updateNumericInput | numeric | default |
| shiny::updateRadioButtons | character, factor, list, logical | radio = TRUE |
| shiny::updateSelectInput | character, factor, list, logical | default |
| shiny::updateSelectizeInput | character, factor, list, logical | selectize = TRUE |
| shiny::updateSliderInput | numeric | slider = TRUE |
| shiny::updateTextAreaInput | character | textbox = TRUE, area = TRUE |
| shiny::updateTextInput | character | textbox = TRUE |
Details
The following arguments passed to ... are supported:
area | (character). Logical. Controls whether to use shiny::updateTextAreaInput
(TRUE) or shiny::updateTextInput (FALSE, default). Only applies when
textbox is TRUE. |
range | (Date, POSIXt). Logical. Controls whether to use shiny::updateDateRangeInput
(TRUE) or shiny::updateDateInput (FALSE, default). |
selectize | (character, factor, list, logical). Logical. Controls whether to use
shiny::updateSelectizeInput (TRUE) or shiny::updateSelectInput
(FALSE, default). For character vectors, selectize only applies if
textbox is FALSE, the default. |
slider | (numeric). Logical. Controls whether to use shiny::updateSliderInput
(TRUE) or shiny::updateNumericInput (FALSE, default) . |
textbox | (character). Logical. Controls whether to update a text input
(TRUE) or a dropdown input (FALSE, default). |
Remaining arguments passed to ... are passed to
args_update_filter_input() or the selected input update function.
Examples
if (FALSE) { # interactive()
library(shiny)
fruits <- list(
"a" = c("apples", "avocados"),
"b" = c("bananas", "blueberries"),
"c" = c("cherries", "cantaloupe")
)
ui <- fluidPage(
sidebarLayout(
sidebarPanel(
filterInput(
x = letters[1:3],
inputId = "letter",
label = "Pick a letter:",
multiple = TRUE
),
filterInput(
x = fruits,
inputId = "fruits",
label = "Pick a fruit:"
)
),
mainPanel()
)
)
server <- function(input, output, session) {
shiny::observe({
fruits_filtered <- fruits
if (!is.null(input$letter) && length(input$letter) != 0L) {
fruits_filtered <- fruits[input$letter]
}
#########################################################
# 2. Call updateFilterInput() inside the shiny server:
updateFilterInput(x = fruits_filtered, inputId = "fruits")
#########################################################
})
}
shinyApp(ui, server)
}