在RShiny中格式化数据表

在RShiny中格式化数据表,r,shiny,datatables,dt,column-width,R,Shiny,Datatables,Dt,Column Width,对于我的数据表,我有以下ui.R文件: tabItem(tabName = "maForwardVsSpot", fluidRow(DT::dataTableOutput(outputId = "maForwardVsSpotTABLE")) 我的server.R如下所示: output$maForwardVsSpotTABLE <- DT::renderDataTable({ DT::datatable(dt.FvsS, rowna

对于我的数据表,我有以下
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'});",
                                                     "}")
                    )
      )
  
})
输出$maForwardVsSpotTABLE这似乎有效:

tabItem(
  tabName = "maForwardVsSpot", 
  tags$div(
    style = "width: fit-content;",
    DT::dataTableOutput(outputId = "maForwardVsSpotTABLE")
  )
)

我从来没见过。您是否尝试过
class='display cell border stripe'
?是的,我已经尝试过了,它没有改变任何东西。。