![](/img/trans.png)
[英]Make DT (DataTable) responsive using flexdashboard with Shiny in R
[英]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.