2016-09-29 88 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")) 
```