Learn R Programming

shinyMobile (version 0.1.0)

updateF7Slider: Change the value of a slider input on the client

Description

Change the value of a slider input on the client

Usage

updateF7Slider(
  session,
  inputId,
  min = NULL,
  max = NULL,
  value = NULL,
  scale = FALSE
)

Arguments

session

The session object passed to function given to the server.

inputId

The id of the input object.

min

Slider minimum range.

max

Slider maximum range

value

Slider value or a vector containing 2 values (for a range).

scale

Slider scale.

Examples

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

 shinyApp(
  ui = f7Page(
    title = "My app",
    f7SingleLayout(
      navbar = f7Navbar(title = "updateF7Slider"),
      f7Card(
        f7Button(inputId = "update", label = "Update slider"),
        f7Slider(
          inputId = "obs",
          label = "Range values",
          max = 500,
          min = 0,
          value = c(50, 100),
          scale = TRUE,
          vertical = FALSE
        ),
        verbatimTextOutput("test")
      )
    )
  ),
  server = function(input, output, session) {

    output$test <- renderPrint({input$obs})

    observeEvent(input$update, {
      updateF7Slider(
        session,
        inputId = "obs",
        value = c(20, 40),
        min = 10,
        max = 50,
        scale = FALSE
      )
    })
  }
 )
}
# }

Run the code above in your browser using DataLab