R垂直滚动不起作用

Posted

技术标签:

【中文标题】R垂直滚动不起作用【英文标题】:R vertical scroll not working 【发布时间】:2017-02-08 02:09:39 【问题描述】:

我正在尝试垂直滚动,但这不起作用,谁能解释为什么?我还想默认一次显示 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')
```

【问题讨论】:

【参考方案1】:

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

【讨论】:

以上是关于R垂直滚动不起作用的主要内容,如果未能解决你的问题,请参考以下文章