change colour of controls in R DT datatable

h.l*_*l.m 5 javascript datatable r shiny

在 R 闪亮和数据表 (DT) 中想要将控件文本的颜色更改为蓝色,因为它表明它可以在这里:

https://datatables.net/manual/styling/theme-creator

通过调整Control text:值,#0000ff这似乎改变文本的分页按钮的颜色是蓝色,以及在网页上搜索文本等,但我想这对于一个闪亮的应用程序与datatable已呈现。任何帮助将非常感激。

请参阅下面的示例,其中文本的文本颜色未更改为蓝色...

  library(DT)
  library(shiny)

  ui=shinyUI(

    fluidPage(
      tags$head(tags$style(HTML("table.dataTable.hover tbody tr:hover, table.dataTable.display tbody tr:hover {
                                background-color: #9c4242 !important;
                                } "))),
      DT::dataTableOutput("tt")
      )
    )

  server=shinyServer(function(input, output) {
    output$tt=DT::renderDataTable(
      DT:::datatable(
        head(iris, 50),rownames = FALSE,options = list(dom='ptl',
                                                       initComplete = JS(
                                                         "function(settings, json) {",
                                                         "$(this.api().table().header()).css({'background-color': '#000', 'color': '#fff'});",
                                                         "}")
        ),
        container = tags$table(
          class="compact",
          tags$thead(tags$tr(lapply(colnames(iris), tags$th)))
        )
      ) %>% formatStyle(columns=colnames(iris),color='white',background = 'black',target = 'row')
    )
  })


  shinyApp(ui=ui,server=server)
Run Code Online (Sandbox Code Playgroud)

Xio*_*Jin 7

这是一个示例(仅包含 UI 代码)

ui=shinyUI(

    fluidPage(
        tags$head(tags$style(HTML("table.dataTable.hover tbody tr:hover, table.dataTable.display tbody tr:hover {
                                  background-color: #9c4242 !important;
                                  }
                                  "))),
        tags$style(HTML(".dataTables_wrapper .dataTables_length, .dataTables_wrapper .dataTables_filter, .dataTables_wrapper .dataTables_info, .dataTables_wrapper .dataTables_processing,.dataTables_wrapper .dataTables_paginate .paginate_button, .dataTables_wrapper .dataTables_paginate .paginate_button.disabled {
            color: #0000ff !important;
        }")),
      DT::dataTableOutput("tt")
        )
    )
Run Code Online (Sandbox Code Playgroud)