When there is a text above a datatable object, the table is truncated and the pagination is no longer visible.
Is it possible to size the datatable to that it fits in one flexdashboard container?
---
title: "Untitled"
output:
flexdashboard::flex_dashboard:
orientation: columns
vertical_layout: fill
---
```{r setup, include=FALSE}
library(flexdashboard)
library(DT)
```
Column {data-width=650}
-----------------------------------------------------------------------
### Chart A
```{r, results='asis'}
cat("This is a text\n\nThis is a text")
```
```{r}
mtcars %>% datatable(options = list(dom = 'tp'))
```
You have a few options. You could use vertical_layout: scroll
. This will allow the pagination to work while keeping the text in the same container as the table.
---
title: "Untitled"
output:
flexdashboard::flex_dashboard:
orientation: columns
vertical_layout: scroll
---
```{r setup, include=FALSE}
library(flexdashboard)
library(DT)
```
Column {data-width=650}
-----------------------------------------------------------------------
### Chart A
```{r, results='asis'}
cat("This is a text\n\nThis is a text")
```
```{r}
mtcars %>% datatable(options = list(dom = 'tp'))
```
Alternatively you could use separate containers for the text and the table. You would probably want to set the height of the containers with {data-height}
if you do this.
---
title: "Untitled"
output:
flexdashboard::flex_dashboard:
orientation: columns
vertical_layout: fill
---
```{r setup, include=FALSE}
library(flexdashboard)
library(DT)
```
Column {data-width=650}
-----------------------------------------------------------------------
### Text A {data-height=50}
```{r, results='asis'}
cat("This is a text\n\nThis is a text")
```
### Chart A
```{r}
mtcars %>% datatable(options = list(dom = 'tp'))
```