DT::datatable output too small in Rmarkdown / flesxdashboard

In the code below I create a report with two tabs; plots on the first tab and data on the second tab. The problem is that data shown on the second tab is only 3 lines and doesn't come close to filling the entire page. I tried many settings but cannot figure out how to make the table bigger (show more lines) and/or fill the entire page. Even changing the setting vertical_layout: scroll to vertical_layout: fill doesn't change the table size at all.

---
title: "test"
output:
  flexdashboard::flex_dashboard:
    orientation: rows
    vertical_layout: scroll
---


```{r global, include=FALSE}

library(rmarkdown)
library(flexdashboard)
library(DT)


# Helper function to download data
create_dt <- function(x){
  DT::datatable(x,
                extensions = 'Buttons',
                options = list(dom = 'Blfrtip',
                               buttons = c('copy', 'csv', 'excel'),
                               lengthMenu = list(c(10, 50, -1),
                                                 c(10, 50, "All"))))
}


```


# Pairs {.tabset}
Row
----

### Daily Active Users

```{r}

plot(1:10, 1:10)

```

### Daily Trades

```{r}

plot(1:10, 1:10)

```

Row 
----

### Daily Trades Per User

```{r}

plot(1:10, 1:10)

```

### Daily Trading Volume

```{r}

plot(1:10, 1:10)

```

# Data

```{r}
create_dt(mtcars)
```

I had the same issue... I fixed this by using a custom style.
I have no idea why... but I'm good with CSS so I fixed it there.

<style>
.dataTables_scrollBody {
    max-height: 100% !important;
}
</style>

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.