繁体   English   中英

使用 Flexdashboard 在 Shiny tabpanel 中用 DataTable 填充容器

[英]Fill container with DataTable in Shiny tabpanel using Flexdashboard

我正在编写一个 flexdashboard,它在选项卡中显示带有 DataTable (DT) 的数据框。

在 DT 和普通 flexdashboard 选项卡上使用fillContainer=T时,我得到了想要的结果:我的数据表填满了它们的整个容器,但不会更多。

Shinyapps.io:带有 DT 的 fillContainer=T 的 Flexdashboard 选项卡

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:带有 DT 的 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:没有 DT 的 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))  
)
```

关于如何正确填充容器的任何想法? 非常感谢

设置fillContainer = FALSE

添加style = "height:550px; overflow-y: scroll;" 作为 tabPanel 的参数。

我在闪亮的仪表板中成功地使用了它,其中 tabPanels 是 tabBox 参数的一部分。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM