[英]change colour of controls in R DT datatable
在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)
這是一個示例(僅包含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")
)
)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.