【问题标题】:Shinydashboard - DataTable widthShinydashboard - 数据表宽度
【发布时间】:2017-11-24 07:51:54
【问题描述】:

我想用绘图和表格创建shinydashboard,但是当使用tabPanels 时,dataTable 总是在框外。我尝试使用 column 和 width 参数指定面板宽度,但它只影响绘图。

有没有办法限制datatable 使其仅显示在tabPanel 内? 谢谢

使用以下代码呈现选项卡:

dashboardBody(
tabItems(
  # First tab content
  tabItem(tabName = "dashboard_total_results",
          fluidRow(

            column(width = 15,

            tabBox(
              title = "Total deal results",
              id = "deal_res_tabset_1", height = "250px",
              tabPanel("Total revenue", 
                       plotlyOutput("total_revenue_plot"),
                       DT::dataTableOutput("total_revenue_table")),
              tabPanel("Total orders", 
                       plotlyOutput("total_orders_plot"),
                       DT::dataTableOutput("total_orders_table")),
              tabPanel("Total margin", 
                       plotlyOutput("total_margin_plot"),
                       DT::dataTableOutput("total_margin_table"))
            )

          )
          )
  )

【问题讨论】:

  • 你能发布一个可重现的例子吗?

标签: r shinydashboard


【解决方案1】:

我认为您实际上需要修复 server 部分并允许滚动列。你应该尝试这样的事情:

output$yourtablename= DT::renderDataTable(server = TRUE,{
  DT::datatable(df,
                extensions=c("Buttons",'Scroller'),
                options = list(dom = 'Bfrtip',
                               scrollY = 500,
                               scroller = TRUE,
                               scrollX=TRUE
                )
  )
})

不确定它是否会起作用,因为我无法重现您的问题。试着告诉我。

【讨论】:

    猜你喜欢
    • 2023-04-01
    • 1970-01-01
    • 2010-12-07
    • 2017-11-19
    • 2011-10-24
    • 1970-01-01
    • 1970-01-01
    • 2020-02-23
    • 1970-01-01
    相关资源
    最近更新 更多