Empty “row-fluid” div at top and bottom of dataTableOutput

后端 未结 1 1147
青春惊慌失措
青春惊慌失措 2021-01-21 18:41

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 bla

相关标签:
1条回答
  • 2021-01-21 18:59

    You can use the sDom option see http://legacy.datatables.net/usage/options#sDom for more details:

    library(shiny)
    runApp(list( ui =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 = 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
                                                             , "sDom" = "rt"
                                                             ))  
      output$example2<-renderDataTable({test})  
    }
    )
    )
    

    enter image description here

    0 讨论(0)
提交回复
热议问题