activate: set an element as active or inactive

Description Usage Arguments See Also Examples

View source: R/active.R

Description

activate will set an element as active or inactive. html_set_active will make an element active. html_set_inactive will hide an element inactive.

Usage

1
2
3
4
5

Arguments

id

shiny input id

state

logical scalar. If state is TRUE, element will be set as active, if FALSE, element will be set as inactive.

See Also

Other javascript functions: ability, click_event, html_class, html_toogle

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
26
27
28
29
30
library(shinytools)

if (interactive()) {
  options(device.ask.default = FALSE)

  ui <- fluidPage(
    titlePanel("Hello dghiesse!"),
    load_jstools(),
    sidebarLayout(
      sidebarPanel(
        actionButton("activate", "activate"),
        actionButton("inactivate", "inactivate")
      ),
      mainPanel(
        actionButton("anybutton", "watch this button", class = "btn-info")
      )
    )
  )

  server <- function(input, output) {
    observeEvent(input$activate, {
      html_set_active("anybutton")
    })
    observeEvent(input$inactivate, {
      html_set_inactive("anybutton")
    })
  }

  print(shinyApp(ui, server))
}

ardata-fr/shinytools documentation built on Nov. 15, 2019, 7:53 p.m.