rstudio / DT

R Interface to the jQuery Plug-in DataTables
https://rstudio.github.io/DT/
Other
587 stars 184 forks source link

some selected rows loose bg (bootstrap 5, rowGroup extension, selection) #1104

Open guasi opened 7 months ago

guasi commented 7 months ago

In a datatable with grouped rows, when an even row is selected in the odd groups, the selected row looses its background color when the cursor moves out of the row.

This only happens when using bootstrap 5 via bslib, extension loads rowGroup, and selection is single or multiple.

Example:

  library(shiny)
  library(DT)

  dat <- data.frame(type = sort(rep(c("A","B","C","D"),5)), value = rnorm(20))

  ui <- bootstrapPage(
    theme = bslib::bs_theme(
      version = 5
    ),
    DTOutput("table")
  )

  server <- function(input, output) {
    output$table <- renderDT({
      datatable(
        dat,
        extensions = "RowGroup",
        selection = "single",
        options = list(
          dom = "t",
          pageLength = 20,
          rowGroup = list(dataSrc = 1)
        )
      )
    })
  }

  shinyApp(ui, server)
Screenshot 2023-12-08 at 10 38 51 PM

The screenshot shows what happens after I select row 12 and then move away from the row. Row 12 looses its backgroup color. The screenshot shows row 12 (even row), under the C group (odd group) to be blank. The interpreted css sets box-shadow: none to the selected row when it should not.

This does not happen when using previous versions of bootstrap in the same set up as defined above. Also it does not happen when using just the DataTable library (bootstrap-5-5.3.0, DataTables-1.13.8, JQuery-3.7.0, RowGroup-1.4.1).

> xfun::session_info()
R version 4.3.2 (2023-10-31)
Platform: aarch64-apple-darwin20 (64-bit)
Running under: macOS Sonoma 14.1.2, RStudio 2023.9.1.494

Locale: en_US.UTF-8 / en_US.UTF-8 / en_US.UTF-8 / C / en_US.UTF-8 / en_US.UTF-8

Package version:
  askpass_1.2.0       base64enc_0.1.3     bslib_0.6.1         cachem_1.0.8        cli_3.6.1          
  commonmark_1.9.0    compiler_4.3.2      crayon_1.5.2        crosstalk_1.2.1     curl_5.2.0         
  digest_0.6.33       DT_0.30             ellipsis_0.3.2      evaluate_0.23       fansi_1.0.6        
  fastmap_1.1.1       fontawesome_0.5.2   fs_1.6.3            glue_1.6.2          graphics_4.3.2     
  grDevices_4.3.2     highr_0.10          htmltools_0.5.7     htmlwidgets_1.6.4   httpuv_1.6.13      
  jquerylib_0.1.4     jsonlite_1.8.8      knitr_1.45          later_1.3.2         lazyeval_0.2.2     
  lifecycle_1.0.4     magrittr_2.0.3      memoise_2.0.1       methods_4.3.2       mime_0.12          
  openssl_2.1.1       packrat_0.9.2       pillar_1.9.0        pkgconfig_2.0.3     promises_1.2.1     
  R6_2.5.1            rappdirs_0.3.3      Rcpp_1.0.11         renv_1.0.3          rlang_1.1.2        
  rmarkdown_2.25      rsconnect_1.1.1     rstudioapi_0.15.0   sass_0.4.8          shiny_1.8.0        
  sourcetools_0.1.7.1 stats_4.3.2         stringi_1.8.2       stringr_1.5.1       sys_3.4.2          
  tibble_3.2.1        tinytex_0.49        tools_4.3.2         utf8_1.2.4          utils_4.3.2        
  vctrs_0.6.5         withr_2.5.2         xfun_0.41           xtable_1.8-4        yaml_2.3.7   

By filing an issue to this repo, I promise that

I understand that my issue may be closed if I don't fulfill my promises.