我尝试搜索有关此的发行说明或问题,但找不到任何...似乎从 shinyjs 启用/禁用的功能不起作用。我认为问题可能是代码,但显示/隐藏工作正常。所以我的问题是这些功能是否已被弃用?
library(shiny)
library(shinyjs)
shinyApp(
ui = fluidPage(
useShinyjs(),
selectInput('in1', 'in1', choices = c('a','b'),
selected = 'a', multiple = TRUE),
dateInput('in2', label = 'in2'),
actionButton('process', 'Process'),
downloadButton('download', 'Download')
),
server = function(input, output, session) {
observeEvent( input$process, {
shinyjs::enable('download')
# shinyjs::show('download')
})
observe({
input$in1
input$in2
shinyjs::disable('download')
# shinyjs::hide('download')
})
# edit
output$download <- downloadHandler(
filename = function() {
date <- format(Sys.Date(), '%Y%m%d')
paste0(date, ' - test.csv') },
content = function(file) {
write.table(1, file)
}
)
}
)