在R shiny和datatable(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)
.dataTables_wrapper .dataTables_length, .dataTables_wrapper .dataTables_filter, .dataTables_wrapper .dataTables_info, .dataTables_wrapper .dataTables_processing, .dataTables_wrapper .dataTables_paginate
- Xiongbing Jin