【发布时间】:2021-01-13 20:13:13
【问题描述】:
对于我的数据表,我有以下ui.R 文件:
tabItem(tabName = "maForwardVsSpot", fluidRow(DT::dataTableOutput(outputId = "maForwardVsSpotTABLE"))
我的server.R 看起来像这样:
output$maForwardVsSpotTABLE <- DT::renderDataTable({
DT::datatable(dt.FvsS, rownames = FALSE, escape = FALSE, class = 'cell-border stripe',
colnames = c("Date", "Spot", input$maStrategy, "Mean Difference"),
options = list(pageLength = 10, autoWidth = TRUE, scrollX = TRUE,
columnDefs = list(list(className = 'dt-center', targets = c(0,1,2,3), width = '200px')),
initComplete = JS("function(settings, json) {",
"$(this.api().table().header()).css({'background-color': '#007d3c', 'color': '#fff'});",
"}")
)
)
})
这会导致以下数据表,其中红色圈出的部分不适合我,因为它们应该与数据表齐平,并且左右距离不远。
【问题讨论】:
-
我从未见过。你试过
class = 'display cell-border stripe'吗? -
是的,我已经尝试过了,它并没有改变任何东西..
标签: r shiny datatables dt column-width