闪亮的仪表板TableOutput没有出现在tabItem中

时间:2019-05-06 10:58:16

标签: shinydashboard tabitem

我想将表格放在menuItem中,但是当我将tableOutput放在tabItem中时,它不会出现。

我试图将其移动到mainPanel中,并且可以正常工作,但是我想添加其他menuItem,所以这并不有趣。

这是我的代码:

    ui <- dashboardPage(

      dashboardHeader(title = "League of Squads"),

      dashboardSidebar(sidebarMenu(menuItem("Data by Spring and Team",tabName="spe",
                                            selectInput(inputId ="selected_team",label = "Select a Team",choices = fakedata$Team, multiple =FALSE),
                                            selectInput(inputId ="selected_spring",label = "Select a Spring",choices = fakedata$Spring, multiple = FALSE)))),

    dashboardBody(
        tabItems(tabItem(tabName = "spe", 
                     fluidRow(
                          box(title = "Table of Team",tableOutput("teamdata"), width = "100%"),
                          box(title="Table of Spring",tableOutput("springdata"), width = "100%"))))))

    server <- function(input, output,session) {
      output$springdata <- renderTable({
        springfilter <- subset (fakedata, fakedata$Spring == input$selected_spring)})


      output$teamdata <- renderTable({
        teamfilter <- subset (fakedata, fakedata$Team == input$selected_team)})

    }

    shinyApp(ui, server)

0 个答案:

没有答案