0

Is there a simple way to get the following tabBox to span the entire height of the dashboardBody?

app_ui <- function() {

    shinydashboard::dashboardPage(
      shinydashboard::dashboardHeader(title = "Baseball Statistics"),
      
      shinydashboard::dashboardSidebar(
        width = 250
      ),
      
      shinydashboard::dashboardBody(
        shinydashboard::box(title = "Individual"),
        shinydashboard::tabBox(title = "Stats",
                               shiny::tabPanel("Batting", DT::DTOutput("batting")),
                               shiny::tabPanel("Pitching", DT::DTOutput("pitching")),
                               shiny::tabPanel("Fielding", DT::DTOutput("fielding"))
                               )
      )
    )
}

I would like the datatable to occupy as much vertical screen as possible:

screenshot

The following answer was not successful - Shinydashboard Tabbox Height

I attempted to integrate the above answer by:

      shinydashboard::dashboardBody(
        shinydashboard::box(title = "Individual"),
        shinydashboard::tabBox(title = "Stats",
                               shiny::tags$head(
                                 shiny::tags$style(shiny::HTML(" #tabBox { height:90vh !important; } "))
                               ),
                               id="tabBox",
                               shiny::tabPanel("Batting", DT::DTOutput("batting")),
                               shiny::tabPanel("Pitching", DT::DTOutput("pitching")),
                               shiny::tabPanel("Fielding", DT::DTOutput("fielding"))
                               )
      )

The output looks like:

screenshot2

Dylan Russell
  • 906
  • 1
  • 7
  • 20

2 Answers2

0

It probably depends on the oter DT options.

When I use only scrollX options

  output$batting <- renderDT(iris, 
                             options = list( scrollX = TRUE))

I get enter image description here

HubertL
  • 18,331
  • 3
  • 25
  • 45
0

This is my final try, it seems the other things didn't work out, so:

  output$dataset <- DT::renderDT(dataframes$df.response,
    callback = JS(js),
    filter = "top",
    rownames = FALSE,
    selection = list(target = "row+column"),
    extensions = c("ColReorder"),
    options = list(
      # scrollX = TRUE,
      # lengthMenu = c(15, 50, 100, 200, 500),
      # colReorder = list(realtime = FALSE),
      pageLength = 1000,
      scrollY=TRUE
   )
  )

the pagelength element to the max rows of your data set it will show it entirely when loading. like in this screen:lasttry. Is this a possible workaround for you?

Patrick Bormann
  • 679
  • 3
  • 15