2

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

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

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

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

4

1 回答 1

0

fillContainer = FALSE

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

我在shinydashboard 中成功使用了它,其中tabPanels 是tabBox 参数的一部分。

于 2019-11-17T21:16:45.030 回答