簡體   English   中英

如何為Shiny數據表添加列邊框?

[英]How do you add column borders for a Shiny datatable?

我有一個閃亮的數據表,看起來像這樣:

在此處輸入圖片說明

但是,我希望它在所有單元格周圍都有完整的邊框,以使其看起來更像一張Excel工作表。 我知道在閃亮表中,它就像調用bordered = T一樣簡單,但不適用於Shiny中的數據表。

這是我的UI代碼:

      fluidRow(
        DT::dataTableOutput("stats_table", width = "95%")
      )

這是我的服務器代碼:

output$stats_table <- DT::renderDataTable(DT::datatable({
  # Do not show a plot when the page first loads
  # Wait until the user clicks "Plot" button
  if (input$plot_graph_button == 0)
    return()

  data <- summary_table
  #### Do some filtering here ####
  data

}))

預先感謝您的幫助,我覺得這應該很容易解決,但是,我沒有找到任何好的信息。 我確實意識到這純粹是裝飾性的,不會影響桌子的功能。

您可以使用cell-border stripe類。 在這里查看更多選項

 output$stats_table <- DT::renderDataTable({
               # Do not show a plot when the page first loads
               # Wait until the user clicks "Plot" button
               # if (input$plot_graph_button == 0)
               # return()

       data <- datatable(head(iris), class = 'cell-border stripe')
       #### Do some filtering here ####
       data

})

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM