【问题标题】:dataTableOutput fit column sizedataTableOutput 适合列大小
【发布时间】:2021-08-16 20:15:26
【问题描述】:

在我需要渲染矩阵的地方构建一个闪亮的仪表板。 为此,我计划使用DT::renderDataTable。

所有内容都在列大小为 3(共 12 个)的 FluidRow 内。 DataTable 分布在定义的列之外。

如何强制表格适应列而不越过它?

【问题讨论】:

    标签: r shiny shinydashboard


    【解决方案1】:

    也许你可以使用splitLayout 来获得你想要的输出。试试这个

    library(shiny)
    library(shinydashboard)
    
    ui <- dashboardPage(
      dashboardHeader(title = "Test App"
      ),
      dashboardSidebar(),
      dashboardBody(
        splitLayout(cellWidths = c("25%", "25%", "50%"),
                    DTOutput("t1"), DTOutput("t2"), DTOutput("t3") 
        )
      )
    )
    
    server <- function(input, output) {
      output$t1 <- renderDT({mtcars})
      output$t2 <- renderDT({mtcars[9:15,]})
      output$t3 <- renderDT({mtcars[21:32,]})
    }
    
    shinyApp(ui, server)
    

    【讨论】:

    • 我不想要滑块,我想缩小表格以适应列允许的空间
    猜你喜欢
    • 2015-11-02
    • 1970-01-01
    • 1970-01-01
    • 2020-08-01
    • 1970-01-01
    • 2013-08-12
    • 2015-07-07
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多