Description Usage Arguments See Also Examples
ability
is to be used to enable or disable an element.
html_enable
and html_disable
are shortcut functions.
1 2 3 4 5 | ability(id, state)
html_enable(id)
html_disable(id)
|
id |
shiny input id |
state |
logical scalar. If state is |
Other javascript functions: activate
,
click_event
, html_class
,
html_toogle
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 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | library(shiny)
library(shinytools)
if (interactive()) {
ui <- fluidPage(
load_jstools(),
fluidRow(
column(width = 4,
actionButton(inputId = "able_slider",
label = "[slider] enabled/disabled"),
br(),br(), br(),
sliderInput( "slider",
"A Number:",
min = 0, max = 1000, value = 500)
),
column(width = 4,
actionButton(inputId = "able_select",
label = "[list] enabled/disabled"),
br(),br(), br(),
selectizeInput("select", "A select input:", 1:5)
),
column(width = 4,
actionButton(inputId = "able_btn",
label = "[btn] enabled/disabled"),
br(),br(), br(),
actionButton("btn", "A button", class = "btn-warning")
)
)
)
server <- function(input, output) {
observeEvent(input$able_slider, {
ability("slider", input$able_slider%%2 < 1)
})
observeEvent(input$able_btn, {
ability("btn", input$able_btn%%2 < 1)
})
observeEvent(input$able_select, {
ability("select", input$able_select%%2 < 1)
})
}
print(shinyApp(ui, server))
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.