我正在尝试垂直滚动,但这不起作用,有人可以解释原因吗?我还想默认一次显示 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')
```

最佳答案

scrollY 参数不是 bool 值。您需要将 table 的固定高度指定为 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"))
```

关于dt - R垂直滚动不起作用,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/39775563/

10-12 18:57