【发布时间】:2019-10-05 23:43:47
【问题描述】:
我正在尝试构建一个闪亮的小工具来使用 DT 库浏览数据表中的数据。我希望 DT 小部件填充整个闪亮的页面或屏幕,但表格以较低的固定高度呈现。如何让表格填充 UI?
我已经将 dataTableOutput 的高度参数设置为 100%,并且我尝试了不同的 UI 容器,例如 fillPage 而不是 miniUI。
这是我的代码的精简版:
library(shiny)
library(miniUI)
library(DT)
ViewDT <- function(data) {
ui <- miniPage(
DT::dataTableOutput("mytable1", height = "100%")
)
server <- function(input, output, session) {
output$mytable1 <- DT::renderDataTable({
table <- DT::datatable(data,
extensions = c('Buttons','Scroller'),
options = list(dom = 'BrtS',
buttons = I('colvis'),
scrollY = 200,
deferRender = TRUE,
paging = T
)
)
})
}
runGadget(ui, server, viewer = dialogViewer("Data"))
}
ViewDT(iris)
结果:The table fills about half of the dialog viewer instead of its entirety.
【问题讨论】: