Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

DT Version 0.3 (Newest) not rendering Table

Tags:

r

dt

shiny

I have a question about the newest DT Version (0.3). After making an update from DT Version 0.2.20 to 0.3, a table after pressing the actionButton is not rendering, not giving any error. After changing my code and implementing eventReactive, a table is rendered. However, I am just curious what has happened that the new version of DT (0.3) is not working well with my old approach or isolate?

Here is code which is going to exactly show this problem:

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)
                     })})})


  }
)
like image 554
Mal_a Avatar asked May 15 '26 08:05

Mal_a


1 Answers

This was due to a bug in DT 0.3 (which has been reported in #488 and #489) and I have fixed it yesterday. For now, please try the development version of DT:

devtools::install_github('rstudio/DT')
like image 54
Yihui Xie Avatar answered May 18 '26 01:05

Yihui Xie



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!