2016-09-29 59 views
2

我想获得一个垂直滚动,但这是行不通的,任何人都可以解释为什么?我也想默认一次显示20行。R垂直滚动不起作用

感谢


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

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")) 
```