Hi,
Returning a list (instead of the renderDataTable or renderTable output) fix the issue. I'm not sure why or if this is a good solution, maybe someone with more expertise in Shiny can explain it better.
library(shiny)
ui <- fluidPage(
mainPanel(
radioButtons("myfilter", choices = c("interactive", "static"), label = "Display Format"),
uiOutput("contents")
)
)
server <- function(input, output) {
output$contents <- renderUI({
if(input$myfilter == "interactive"){
list(DT::renderDataTable({mtcars}))
} else {
list(renderTable({ mtcars }))
}
})
}
shinyApp(ui, server)
Regards,