Change the value of a picker input on the client
updateF7Picker( inputId, value = NULL, choices = NULL, rotateEffect = NULL, openIn = NULL, scrollToInput = NULL, closeByOutsideClick = NULL, toolbar = NULL, toolbarCloseText = NULL, sheetSwipeToClose = NULL, session = shiny::getDefaultReactiveDomain() )
inputId | The id of the input object. |
---|---|
value | Picker initial value, if any. |
choices | New picker choices. |
rotateEffect | Enables 3D rotate effect. Default to TRUE. |
openIn | Can be auto, popover (to open picker in popover), sheet (to open in sheet modal). In case of auto will open in sheet modal on small screens and in popover on large screens. Default to auto. |
scrollToInput | Scroll viewport (page-content) to input when picker opened. Default to FALSE. |
closeByOutsideClick | If enabled, picker will be closed by clicking outside of picker or related input element. Default to TRUE. |
toolbar | Enables picker toolbar. Default to TRUE. |
toolbarCloseText | Text for Done/Close toolbar button. |
sheetSwipeToClose | Enables ability to close Picker sheet with swipe. Default to FALSE. |
session | The Shiny session object, usually the default value will suffice. |
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"), br(), f7Button(inputId = "removeToolbar", label = "Remove picker toolbar", color = "red") ) ) ), server = function(input, output, session) { output$pickerval <- renderText(input$mypicker) observeEvent(input$update, { updateF7Picker( inputId = "mypicker", value = "b", choices = letters, openIn = "sheet", toolbarCloseText = "Prout", sheetSwipeToClose = TRUE ) }) observeEvent(input$removeToolbar, { updateF7Picker( inputId = "mypicker", value = "b", choices = letters, openIn = "sheet", toolbar = FALSE ) }) } ) }