Closed alanfarahani closed 7 months ago
Hi @alanfarahani and thanks for the excellent reprex! The root cause of the problem is that DT::formatStyle()
works in a way that is incompatible with the way that tables are styled in Bootstrap 5. It isn't something bslib is doing specifically, just that the way that tables are styled has evolved and the styling assumptions made by DT no longer hold, at least in BS5.
I'm moved this issue to the DT repo. If a fix beyond using style = "default"
is feasible, it will have to come from DT rather than bslib.
Hi @gadenbuie, I had wondered whether this was possibly DT::formatStyle()
issue, and now you've answered the question! Thanks for the detailed response, and for passing this along.
Edit: I should add, per the last issue posted to DT. That I have tried the reprex above using the development versions of both DT and bslib.
See session info below:
─ Session info ────────────────────────────────────────────────────────────────────────────────────
setting value
version R version 4.3.0 (2023-04-21 ucrt)
os Windows 10 x64 (build 19045)
system x86_64, mingw32
ui RStudio
language (EN)
collate English_United States.utf8
ctype English_United States.utf8
tz America/Los_Angeles
date 2023-12-07
rstudio 2023.06.1+524 Mountain Hydrangea (desktop)
pandoc NA
─ Packages ────────────────────────────────────────────────────────────────────────────────────────
package * version date (UTC) lib source
bsicons 0.1 2022-11-22 [1] CRAN (R 4.3.0)
bslib * 0.6.1.9000 2023-12-06 [1] Github (rstudio/bslib@148908a)
cachem 1.0.8 2023-05-01 [1] CRAN (R 4.2.3)
callr 3.7.3 2022-11-02 [1] CRAN (R 4.3.0)
cli 3.6.1 2023-03-23 [1] CRAN (R 4.2.3)
crayon 1.5.2 2022-09-29 [1] CRAN (R 4.3.0)
crosstalk 1.2.1 2023-11-23 [1] CRAN (R 4.3.2)
devtools 2.4.5 2022-10-11 [1] CRAN (R 4.3.0)
digest 0.6.33 2023-07-07 [1] CRAN (R 4.3.2)
dplyr * 1.1.2 2023-04-20 [1] CRAN (R 4.2.3)
DT * 0.30.3 2023-12-07 [1] Github (rstudio/DT@b42dd91)
ellipsis 0.3.2 2021-04-29 [1] CRAN (R 4.2.1)
fansi 1.0.4 2023-01-22 [1] CRAN (R 4.2.3)
This issue appears to be resolved in the development version.
Hello everyone,
Sorry to comment in a closed post, but it appears I have the exact same problem, with the same reprex, with current CRAN versions and current development versions of bslib and DT, and the style="default" workaround is not an option in my case.
Is there anything I'm missing?
Hi all,
The issue has already been raised in an SO post, but I wonder if a solution can be implemented in the back-end.
The problem
Unless I'm missing something, the bootstrap formatting of bslib appears to override any DT "formatStyle" calls for tables whose styles are not the default. That means choosing "auto" or "bootstrap5" will prevent any data-conditional table rendering apart from an implementation in css / javascript.
It would be great to use the bootstrap5 styling provided by bslib and programmatically format a table using "formatStyle".
MRE
Session Info