【问题标题】:Dashboard body does not resize with change in DT length仪表板主体不会随着 DT 长度的变化而调整大小
【发布时间】:2018-04-09 16:17:24
【问题描述】:

当 DTOutput 显示更多行时,仪表板页面不会展开。输出是可见的,但看起来它不再包含在仪表板页面中。

ui <- function() { 
 dashboardPage(
  dashboardHeader(),
  dashboardSidebar(),
  dashboardBody(
   mainPanel(width = 12,
             fluidRow(DTOutput(outputId = "table"))
  )))}

server <- function(input, output) {
 data <- data.frame(1:100)
 output$table <- renderDT(
  data
 )
}

shinyApp(ui = ui, server = server)

Screenshot of issue.

仪表板页面的灰色背景在第 15 行左右结束。

【问题讨论】:

    标签: r shiny shinydashboard dt


    【解决方案1】:

    这可以通过在文档中添加一些 CSS 来解决:

    section.content { 
      overflow-y: hidden; 
    }
    

    MWE:

    library(shiny)
    library(shinydashboard)
    library(DT)
    library(htmltools)
    ui <- function() { 
      dashboardPage(
        dashboardHeader(),
        dashboardSidebar(),
        dashboardBody(
          tags$head(tags$style("section.content { overflow-y: hidden; }")),
          mainPanel(width = 12,
                    fluidRow(DTOutput(outputId = "table"))
          )))}
    
    server <- function(input, output) {
      data <- data.frame(1:100)
      output$table <- renderDT(
        data
      )
    }
    
    shinyApp(ui = ui, server = server)
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-11-29
      • 1970-01-01
      • 2018-09-15
      • 2022-08-23
      相关资源
      最近更新 更多