【发布时间】:2017-10-16 14:21:19
【问题描述】:
我正在编写一个 flexdashboard,它在选项卡中显示带有 DataTable (DT) 的数据框。
在 DT 和普通 flexdashboard 选项卡上使用 fillContainer=T 时,我得到了想要的结果:我的数据表填满了整个容器,但没有更多。
Shinyapps.io : Flexdashboard Tabs with DT's fillContainer=T
Flexdashboard Tabs with DT::FillContainer
======================
Column {.tabset .tabset-fade}
-----------------------------------------------------------------------
### iris
```{r}
DT::datatable(
iris,
fillContainer = T,
rownames = F)
```
### mtcars
```{r}
DT::datatable(
mtcars,
fillContainer = T,
rownames = F)
```
我现在尝试使用由闪亮动态生成的选项卡和tabsetPanel,而不是 flexdashboard 选项卡。我尝试了有和没有fillContainer=T。但是数据表并没有完全填充容器,并且高度太长或非常短(少于 2 行)。在这两种情况下,分页选项都显示在最后一行下方,而不是容器底部。
Shinyapps.io : Shiny Tabs with DT's fillContainer=T
Shiny Tabs with DT::fillContainer
======================
Column {.tabset .tabset-fade}
-----------------------------------------------------------------------
### Tabs container with fillContainer
```{r}
library(shiny)
tabsetPanel(
tabPanel("iris",
DT::datatable(
iris,
fillContainer = T,
rownames = F)),
tabPanel("mtcars",
DT::datatable(
mtcars,
fillContainer = T,
rownames = F))
)
```
Shinyapps.io : Shiny Tabs without DT's fillContainer=T
Shiny Tabs without DT::fillContainer
======================
Column {.tabset .tabset-fade}
-----------------------------------------------------------------------
### Tabs container without fillContainer
```{r}
library(shiny)
tabsetPanel(
tabPanel("iris",
DT::datatable(
iris,
fillContainer = F,
rownames = F)),
tabPanel("mtcars",
DT::datatable(
mtcars,
fillContainer = F,
rownames = F))
)
```
知道如何正确填充容器吗? 非常感谢
【问题讨论】:
-
我的错,我以为是关于宽度(右侧对齐);)
标签: r datatables shiny flexdashboard