启用/禁用从shinyjs删除?

时间:2016-04-28 16:29:41

标签: r shiny shinyjs

我尝试搜索发布说明或有关此问题,但无法找到... 似乎从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)
      }
    )
  }
)

0 个答案:

没有答案