这是来自http://shiny.rstudio.com/gallery/widget-gallery.html的简单示例。初始化引导开关后,单击按钮时输出不会改变。我错过了什么?
library(shiny)
ui <- shinyUI(fluidPage(
tags$head(tags$link(rel = "stylesheet", type = "text/css", href = "//cdnjs.cloudflare.com/ajax/libs/bootstrap-switch/3.3.2/css/bootstrap3/bootstrap-switch.min.css")),
tags$head(tags$script(src='//cdnjs.cloudflare.com/ajax/libs/bootstrap-switch/3.3.2/js/bootstrap-switch.min.js',type='text/javascript')),
tags$head(tags$script("$(document).ready(function($) {
$('#check').bootstrapSwitch();
});",
type='text/javascript')),
checkboxInput("check", label = "", value = TRUE),
fluidRow(column(3, verbatimTextOutput("value")))
))
server <- shinyServer(function(input, output) {
output$value <- renderPrint({ input$check })
outputOptions(output, "value", suspendWhenHidden = FALSE)
})
shinyApp(ui, server)