click: Programmatically click a button

Description Usage Arguments Author(s) Examples

View source: R/click.R

Description

Programmatically click a button

Usage

1
click(ids)

Arguments

ids

id(s) of button to be clicked

Author(s)

richard.kunze

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
## Only run examples in interactive R sessions
if (interactive()) {

library(shiny)
shinyApp(
  ui = fluidPage(
    fluidRow(
      numericInput("clickBtn", "Click Btn Nr:", 1, 1, 3, 1),
      actionButton("btn1", "1"),
      actionButton("btn2", "2"),
      actionButton("btn3", "3"),
      dq_space(),
      textOutput("result")
    )
  ),
  server = function(input, output) {
    output$result <- renderText(paste("Buttons clicked:",
      toString(c(input$btn1, input$btn2, input$btn3))
    ))
    observeEvent(input$clickBtn, click(paste0("btn", input$clickBtn)),
                 ignoreInit = TRUE)
  }
)

}

daqana/dqshiny documentation built on Sept. 1, 2020, 4:31 p.m.