15

I am trying to get a vertical scroll but this isn't working, can anybody explain why? I would also like to default to show 20 rows at once.

Thanks


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}
datatable(cars ,options = list(c(bPaginate = F, scrollY=T)),  filter = 'top')
```
Anon.user111
  • 468
  • 1
  • 5
  • 16

1 Answers1

28

The scrollY parameter isn't a boolean. You need to specify the fixed height of your table as per the datatables documentation.

---
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}
DT::datatable(cars, filter = "top",
                    options = list(pageLength = 20, scrollY = "200px"))
```
Carl
  • 5,569
  • 6
  • 39
  • 74