Skip to content

Problem with reactable table when knitting with chrome_print #222

@maibennett

Description

@maibennett

Hi,

I had an issue when trying to knit a reactable table using chrome_print. For some reason, when I don't include LaTeX code, the reactable table doesn't show up in the PDF, but if I do, then it actually shows up.

Here's a simple reproducible code, if it's useful:

  1. This is the code that works:
---
title: "Example for reactable"
author: "maibennett"
date: "April 14th, 2021"
output:
  pagedown::html_paged:
    toc: no
    number_sections: no
paged-footnotes: true 
knit: pagedown::chrome_print
---

```{r setup, warning=FALSE, message=FALSE, echo=FALSE}
library(tidyverse)
library(reactable)
library(htmltools)
```

$$\text{Including this, works}$$

```{r, echo = FALSE, message=FALSE, warning=FALSE}

data(USArrests)
   
USArrests_s <- USArrests %>% dplyr::filter(rownames(.)=="Alabama" | rownames(.)=="Alaska")

tbl <- USArrests_s %>%
  reactable(
    pagination = TRUE,
    rownames = FALSE,
    defaultColDef = colDef(
      align = "center",
      minWidth = 90)
    
  )

div(
    class = "title",
    h3("This is a table"),
  tbl
)

```
  1. This code doesn't show the reactable table:
---
title: "Example for reactable"
author: "maibennett"
date: "April 14th, 2021"
output:
  pagedown::html_paged:
    toc: no
    number_sections: no
paged-footnotes: true 
knit: pagedown::chrome_print
---

```{r setup, warning=FALSE, message=FALSE, echo=FALSE}
library(tidyverse)
library(reactable)
library(htmltools)
```

```{r, echo = FALSE, message=FALSE, warning=FALSE}

data(USArrests)
   
USArrests_s <- USArrests %>% dplyr::filter(rownames(.)=="Alabama" | rownames(.)=="Alaska")

tbl <- USArrests_s %>%
  reactable(
    pagination = TRUE,
    rownames = FALSE,
    defaultColDef = colDef(
      align = "center",
      minWidth = 90)
    
  )

div(
    class = "title",
    h3("This is a table"),
  tbl
)
```

I've included both PDFs outputs. If anyone has an idea of why this might be, I'd really appreciate it! Thanks.
reactable_example2.pdf
reactable_example1.pdf

Metadata

Metadata

Assignees

No one assigned

    Labels

    duplicatealready another issue about this

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions