Unlimited learning, half price | 50% off

Last chance! 50% off unlimited learning

Sale ends in


shinyMobile (version 0.7.0)

updateF7Select: Change the value of a select input on the client

Description

Change the value of a select input on the client

Usage

updateF7Select(
  inputId,
  selected = NULL,
  session = shiny::getDefaultReactiveDomain()
)

Arguments

inputId

The id of the input object.

selected

New value.

session

The Shiny session object, usually the default value will suffice.

Examples

Run this code
# NOT RUN {
if (interactive()) {
 library(shiny)
 library(shinyMobile)

 shinyApp(
   ui = f7Page(
     title = "My app",
     f7SingleLayout(
       navbar = f7Navbar(title = "updateF7Select"),
       f7Card(
         f7Button(inputId = "update", label = "Update select"),
         br(),
         f7Select(
          inputId = "variable",
          label = "Choose a variable:",
          choices = colnames(mtcars)[-1],
          selected = "hp"
         ),
         verbatimTextOutput("test")
       )
     )
   ),
   server = function(input, output, session) {

     output$test <- renderPrint(input$variable)

     observeEvent(input$update, {
       updateF7Select(
         inputId = "variable",
         selected = "gear"
       )
     })
   }
 )
}
# }

Run the code above in your browser using DataLab