Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

R vertical scroll not working

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')
```
like image 994
Anon.user111 Avatar asked Sep 29 '16 16:09

Anon.user111


1 Answers

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"))
```
like image 131
Carl Avatar answered Nov 13 '22 21:11

Carl