DT datatable所选行颜色:IE和chrome上的行为不一致
我有一个类似于下面的应用程序,我想自定义通过DT渲染的选定行的颜色。我的应用程序代码如下所示DT datatable所选行颜色:IE和chrome上的行为不一致,r,shiny,dt,R,Shiny,Dt,我有一个类似于下面的应用程序,我想自定义通过DT渲染的选定行的颜色。我的应用程序代码如下所示 library(shiny) library(DT) bkg_shade <-"#2c3e50" ui <- fluidPage( tags$style(HTML(paste0("table.dataTable tr.selected td, table.dataTable td.selected{background-color: ",
library(shiny)
library(DT)
bkg_shade <-"#2c3e50"
ui <- fluidPage(
tags$style(HTML(paste0("table.dataTable tr.selected td, table.dataTable td.selected{background-color: ",
bkg_shade," !important;}"))),
fluidRow(dataTableOutput("tbl"))
)
server <- function(input, output){
output$tbl <- renderDataTable({
datatable(mtcars)
})
}
app <- shinyApp(ui = ui, server= server)
runApp(app)
库(闪亮)
图书馆(DT)
bkg_shade我的代码也有类似的问题,几乎放弃了找到解决方案的希望。然而,一个小小的调整似乎可以解决这个问题
您会注意到唯一真正的变化是插入了t正文。你应该能够保持一切正常
library(shiny)
library(DT)
bkg_shade <-"#2c3e50"
ui <- fluidPage(
tags$style(HTML(paste0("table.dataTable tbody tr.selected td, table.dataTable td.selected{background-color: ", bkg_shade," !important;}"))),
fluidRow(dataTableOutput("tbl"))
)
server <- function(input, output){
output$tbl <- renderDataTable({
datatable(mtcars)
})
}
app <- shinyApp(ui = ui, server= server)
runApp(app)
库(闪亮)
图书馆(DT)
bkg_shade感谢您这么晚才回答这个问题-我相信如果不是这样,我会花上几个小时寻找解决方案。