I have a shiny example using renderDataTable() to create an output.
I have removed all possible options (paging, filtering, searching, etc). However, there is now a blank row at the top and bottom of my table output, where the filtering and searching used to be.
How can I remove these two divs from inside the datatable wrapper, only when I have removed the filtering and searching options?
ui.R:
library(shiny)
shinyUI(pageWithSidebar(
headerPanel("dataTable Example"),
sidebarPanel(
"This is a sidebar"
),
mainPanel(
p("Check out the gaps below."),
wellPanel(
dataTableOutput('example1')),
p("No gaps here because of searching and paging."),
wellPanel(
dataTableOutput('example2')
)
)
)
)
server.R:
library(shiny)
shinyServer(function(input, output) {
x<-c(1,2,3,4,5)
y<-c('a','b','c','d','e')
test<-data.frame(x,y)
output$example1<-renderDataTable({test},options = list(iDisplayLength = 5,bSearchable = FALSE
,bFilter=FALSE,bPaginate=FALSE,bAutoWidth=TRUE
,bInfo=0,bSort=0))
output$example2<-renderDataTable({test})
})
You can use the
sDom
option see http://legacy.datatables.net/usage/options#sDom for more details: