从这里(请参阅突出显示已排序的标题)我了解如何突出显示已排序的标题。如果标题已经有背景颜色,是否可以修改此方法以突出显示已排序的标题列?
突出显示排序的标题 - 无默认背景底纹(作品)
library(shiny)
library(reactable)
ui <- fluidPage(
theme = "test.css",
reactableOutput("table")
)
server <- function(input, output, session) {
output$table <- renderReactable({
reactable(iris,
defaultColDef = colDef(
# Use css to style the header of the sorted column
headerClass = "sort-header")
)
})
}
shinyApp(ui, server)
突出显示已排序的标题 - 使用默认背景底纹(失败)
library(shiny)
library(reactable)
ui <- fluidPage(
theme = "test.css",
reactableOutput("table")
)
server <- function(input, output, session) {
output$table <- renderReactable({
reactable(iris,
defaultColDef = colDef(
headerStyle = list(background = "#00FF00"),
# Use css to style the header of the sorted column
headerClass = "sort-header")
)
})
}
shinyApp(ui, server)
测试.css
.sort-header[aria-sort="ascending"],
.sort-header[aria-sort="descending"] {
background: rgba(255, 0, 0, 1);
}