13

我正在尝试垂直滚动,但这不起作用,有人可以解释为什么吗?我还想默认一次显示 20 行。

谢谢


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')
```
4

1 回答 1

26

scrollY参数不是布尔值。您需要根据datatables 文档指定表格的固定高度。

---
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"))
```
于 2016-09-30T21:52:28.487 回答