I am getting this warning every time I run my shiny
App.
Warning in processWidget(instance) : renderDataTable ignores ... arguments when expr yields a datatable object; see ?renderDataTable
This is a reproducible example:
library(shiny)
library(DT)
ui <- fluidPage(
titlePanel("My app"),
sidebarLayout(
sidebarPanel(
),
mainPanel(
dataTableOutput("table")
)
)
)
server <- function(input, output, session) {
output$table <- renderDataTable({
datatable(
mtcars,
filter = list(position = 'top', clear = FALSE),
selection = "none", #this is to avoid select rows if you click on the rows
rownames = FALSE,
extensions = 'Buttons',
options = list(
scrollX = TRUE,
autoWidth = TRUE,
dom = 'Blrtip',
buttons =
list('copy', 'print', list(
extend = 'collection',
buttons = list(
list(extend = 'csv', filename = "file", title = NULL),
list(extend = 'excel', filename = "file", title = NULL)),
text = 'Download'
)),
lengthMenu = list(c(10, 30, 50, -1),
c('10', '30', '50', 'All'))
),
class = "display"
)
},rownames=FALSE)
}
shinyApp(ui, server)
I checked this post but I am not using the parameter filter
at the end. I am using it inside DT::datatable
. What is more, if I comment this line (filter = list(position = 'top', clear = FALSE)
), I am still getting the same warning. So it must be because of another reason.
Does anyone know how to fix it?
Thanks in advance