rstudio/DT

`renderDT()` evaluates `...` in `expr`'s `env`

cpsievert opened this issue · 0 comments

The reprex below results in Error in argFunc: object 'opts' not found since renderDT() evaluates its ... in env, which is likely wrong when quoted = TRUE. I'll send a PR to fix this.

BTW, I stumbled across in this in my efforts to address rstudio/shiny#3986. As a part of that, we're hoping to deprecate shiny::renderDataTable() in favor of DT::renderDT() (and, by default, have shiny::renderDataTable() call out to DT::renderDT() if available). This issue presents a challenge to doing that properly, so a CRAN release with this fix would be very much appreciated. (cc @jcheng5)

library(shiny)
library(DT)

dat <- mtcars
expr <- quote(dat)
env <- environment()

ui <- fluidPage(
  DT::DTOutput("dt")
)

server <- function(input, output, session) {
  opts <- list()
  output$dt <- DT::renderDT(expr, quoted = TRUE, env = env, options = opts)
}

shinyApp(ui, server)