0
votes

I'm building a sample Shiny dashboard in the R Studio console. I have some tables:

output$summary_table <- DT::renderDataTable(DT::datatable({
    # some code here
})

When this table gets displayed it has things like pagination and a search box. I would like to remove those but the documentation (https://datatables.net/reference/option/) seems to all be based on editing JS/html e.g.

$('#example').dataTable( {
    "paging": false
} );

Is there a way to do this within DT::datatable({}) instead? I would not know how to integrate this with my R code as is? Or is it simple and I'm just not getting the intended use?

I would like to remove pagination and search box.

1
You can refer to this link for DT datatable styling and options in shiny.SBista

1 Answers

1
votes

You can use this:

datatable(iris,options=list(bFilter=FALSE, bPaginate=FALSE))

or to show only table:

datatable(iris,options = list(dom='t',bPaginate=FALSE))

Full Example Code:

library(shiny)
library(DT)

ui= basicPage(dataTableOutput("tab"))

server= function(input, output,session) {

  output$tab <-  DT::renderDataTable({datatable(iris,options=list(bFilter=FALSE, bPaginate=FALSE))})
}

shinyApp(ui, server)