使用Flexdashboard在Shiny选项卡面板中填充DataTable容器

3
我正在编写一个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)
```

我现在正在尝试使用由shiny动态生成的选项卡(使用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 : 不使用DT的fillContainer=T的Shiny标签页

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

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


我的错,我以为是关于宽度(右对齐)的问题 ;) - Tonio Liebrand
我也遇到了这些问题,目前有解决方法吗? - dbogdan
1个回答

0

设置 fillContainer = FALSE

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

我在 shinydashboard 中使用过这个方法,其中 tabPanels 是 tabBox 参数的一部分,并且取得了成功。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接