【问题标题】:R Shiny: Content of tabItem not showing when there are menuSubItemsR Shiny:当有 menuSubItems 时,tabItem 的内容不显示
【发布时间】:2016-12-08 11:25:23
【问题描述】:

考虑以下 R Shiny 代码:

# ui.R

library(shiny)
library(shinydashboard)


dashboardPage(
  dashboardHeader(),
  dashboardSidebar(
    sidebarMenu(
      menuItem("First", tabName="First"),
      menuItem("Transportation", tabName = "Transportation",  
                         menuSubItem("Air", tabName = "Air"),
                         menuSubItem("Maritime", tabName = "Maritime")))),
  dashboardBody(tabItems(tabItem(tabName = "First",
                                 headerPanel('First')),
                         tabItem(tabName = "Transportation",
                                 headerPanel('Transportation')),
                         tabItem(tabName = "Air",
                                 headerPanel('Air')),
                         tabItem(tabName = "Maritime",
                                 headerPanel('Maritime')))))

当我点击交通菜单项时,为什么我看不到headerPanel('Transportation')

这是预期的行为吗?在对应的 menuItem 有 menuSubItems 的情况下,是否应该忽略 tabItem 中的内容的预期行为?

【问题讨论】:

    标签: r shiny


    【解决方案1】:

    我不能 100% 确定这就是你要找的东西,但是这会让 headerPanel 显示交通:

    menuItem("Transportation", tabName = "Transportation",  
                   menuSubItem("Air", tabName = "Air"),
                   menuSubItem("Maritime", tabName = "Maritime"),
                   menuSubItem("Transportation", tabName = "Transportation")))),
    

    【讨论】:

    • 不,这不是我要找的。如果这是预期的行为,那很好;我只想知道这是预期的行为。
    • 嗯。我对shinydashboard 不够熟悉,不知道这是否应该预期
    猜你喜欢
    • 2018-06-20
    • 1970-01-01
    • 2016-02-20
    • 2019-08-02
    • 2018-12-21
    • 2020-12-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多