Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

renderDT() evaluates ... in expr's env #1129

Closed
cpsievert opened this issue Mar 14, 2024 · 0 comments · Fixed by #1130
Closed

renderDT() evaluates ... in expr's env #1129

cpsievert opened this issue Mar 14, 2024 · 0 comments · Fixed by #1130

Comments

@cpsievert
Copy link
Contributor

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)
yihui pushed a commit that referenced this issue Mar 14, 2024
 Close #1129. Always evaluate renderDT()'s ... in the parent.frame()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant