数据表不会在Shinydashboard中呈现 . 它只是为盒子呈现一条薄薄的白色条带 . 仅在RStudio中运行数据表函数会在RStudio查看器中呈现数据表 . 那么在闪亮的应用程序中呈现DT数据表的正确方法是什么?
## app.R ##
library(shiny)
library(shinydashboard)
library(htmlwidgets)
library(DT)
library(xtable)
source('../ts01/db.R')
ui <- dashboardPage(
dashboardHeader(),
dashboardSidebar(),
dashboardBody(
fluidRow(
box(tableOutput("table1"))
)
)
)
server <- function(input, output) {
output$table1 <- DT::renderDataTable({
datatable(amount_data)
})
}
shinyApp(ui, server)
2 回答
您应该尝试以下方法:
1)
tableOutput
2)
dataTableOutput
要确保使用正确的包来呈现您的数据表,请在您的ui中使用它: