Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

autoWidth Rendering Garbled #291

Open
ghost opened this issue Nov 4, 2020 · 2 comments
Open

autoWidth Rendering Garbled #291

ghost opened this issue Nov 4, 2020 · 2 comments

Comments

@ghost
Copy link

ghost commented Nov 4, 2020

---
title: "autoWidth garbled"
output: flexdashboard::flex_dashboard
---

```{r}
library(tidyverse)
library(DT)
datatable(mtcars %>% as_tibble() %>% select(1:4), 
          options = list(autoWidth = TRUE,
                         columnDefs = list(list(width = '50px', 
                                                targets = "_all"))))
```

The code above is my first attempt at autoWidth within DT and flexdashboard. The code looks correct, yet the output is quite garbled (ie the column headings are not aligned with the column bodies). Tested in Chrome. I imagine IE and Safari won't fare much better. Version Info: [1] DT_0.16 flexdashboard_0.5.2

autowidth not working

@cpsievert
Copy link
Collaborator

Does that {DT} code work for you outside of {flexdashboard} (if so, can you also please include a screenshot of the "expected" result?)

@gadenbuie
Copy link
Member

I can reproduce this. The key is that the header column should be centered over the table but it moves whenever the window is resized. It appears as expected in an html_document() so there's a chance it's the result of an interaction with flexdashboard's CSS.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants