【问题标题】:How do you change the color of title of table generated with DT library in shiny app?如何在闪亮的应用程序中更改使用 DT 库生成的表格标题的颜色?
【发布时间】:2021-09-11 09:36:06
【问题描述】:

我正在我闪亮的应用程序中渲染一个表格。表是用 DT 库生成的。 这是代码:

output$table <- DT::renderDataTable(DT::datatable({# Displaying table in section tab for principal and director
    if (user_logged$Designation=='director'|user_logged$Designation=='principal'){
    data <- teacher_info[teacher_info$Section == input$sections,]
    data <- data%>%
      select(-c(Section))
    }

这是输出: Table 正如您所看到的,由于背景颜色,列标题和其他标题变得晦涩难懂。我想更改这些文本的颜色,如果可能的话,我还想更改表格的背景颜色。

【问题讨论】:

    标签: css r shiny dt bs4dash


    【解决方案1】:

    我认为您的问题与How to change shiny app dataTableOutput font color and auxiliary table element color? 的问题类似

    你可以添加

    tags$style(HTML(
    ".dataTables_wrapper .dataTables_length, .dataTables_wrapper .dataTables_filter, .dataTables_wrapper .dataTables_info, .dataTables_wrapper .dataTables_processing, .dataTables_wrapper .dataTables_paginate {
                        color: #ffffff;
                        }"))
    

    作为 ui 的内联 CSS,该链接还显示了如何更改相关的页码

    【讨论】:

      猜你喜欢
      • 2019-06-16
      • 2022-01-04
      • 2020-09-12
      • 2020-01-13
      • 2018-11-01
      • 1970-01-01
      • 2014-07-02
      • 2015-10-21
      • 2016-02-18
      相关资源
      最近更新 更多