【问题标题】:DT Version 0.3 (Newest) not rendering TableDT 版本 0.3(最新)不呈现表
【发布时间】:2018-07-04 09:31:48
【问题描述】:

我对最新的 DT 版本 (0.3) 有疑问。从 DT 版本 0.2.20 更新到 0.3 后,按下actionButton 后的表格没有呈现,没有给出任何错误。在更改我的代码并实现eventReactive 后,会呈现一个表格。但是,我只是好奇新版本的 DT (0.3) 与我的旧方法或 isolate 不能很好地配合是怎么回事?

以下代码将准确显示此问题:

library(shiny)
library(DT)
shinyApp(
  ui = fluidPage(radioButtons("buttons","", choices = c("iris","mtcars")),
                 actionButton("button1", "Choose"),
                 DT::dataTableOutput('tbl'),
                 DT::dataTableOutput('tbl2')),
  server = function(input, output) {

    #1st possibility with eventReactive WORKING WITH THE NEW DT VERSION (0.3)


    data <- eventReactive(input$button1,
                          {if(input$buttons  == "mtcars"){mtcars}else{
                            iris}
                          })

    output$tbl = DT::renderDataTable({
      datatable(data())}
    )

    #2nd possibility with isolate WHICH IS NOT WORKING WITH DT = 0.3 BUT IT IS WORKING WITH DT = 0.2.20!! 

    output$tbl2 <- renderDataTable ({
      withProgress(message = 'Processing...', style = "old",value = 0, 
                   {

                     for (i in 1:10) {
                       incProgress(1/30)
                       Sys.sleep(0.1)
                     }
                     if( input$button1 == 0)
                     {
                       return()
                     }
                     isolate({
                       data <- if(input$buttons  == "mtcars"){mtcars}else{
                         iris}
                       datatable(data)
                     })})})


  }
)

【问题讨论】:

  • 听起来像是 DT 的 bug。我现在正在调查它。谢谢!

标签: r shiny dt


【解决方案1】:

这是由于 DT 0.3 中的一个错误(已在 #488#489 中报告),我昨天收到了 fixed it。现在,请尝试DT的开发版:

devtools::install_github('rstudio/DT')

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-04-25
    • 2020-06-21
    • 2021-11-10
    • 2022-11-28
    • 2015-04-23
    • 1970-01-01
    • 2022-07-20
    相关资源
    最近更新 更多