Learn R Programming

shinyMobile (version 0.1.0)

updateF7Picker: Change the value of a picker input on the client

Description

Change the value of a picker input on the client

Usage

updateF7Picker(session, inputId, value = NULL, choices = NULL)

Arguments

session

The session object passed to function given to the server.

inputId

The id of the input object.

value

Picker initial value, if any.

choices

New picker choices.

Examples

Run this code
# NOT RUN {
if (interactive()) {
 library(shiny)
 library(shinyMobile)
 shinyApp(
  ui = f7Page(
    title = "My app",
    f7SingleLayout(
      navbar = f7Navbar(title = "Update picker"),
      f7Card(
        f7Button(inputId = "update", label = "Update picker"),
        f7Picker(
          inputId = "mypicker",
          placeholder = "Some text here!",
          label = "Picker Input",
          choices = c('a', 'b', 'c')
        ),
        verbatimTextOutput("pickerval")
      )
    )
  ),
  server = function(input, output, session) {

    output$pickerval <- renderText(input$mypicker)

    observeEvent(input$update, {
      updateF7Picker(
        session,
        inputId = "mypicker",
        value = "b",
        choices = letters
      )
    })
  }
 )
}
# }

Run the code above in your browser using DataLab