R Shiny:当menuSubItems时,tabItem的内容不显示

时间:2016-08-02 22:56:39

标签: r shiny

考虑以下R Shiny代码:

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div>1</div>
<div>2</div>
<div>3</div>
<div>4</div>
<div>5</div>

当我点击 Transportation 菜单项时,为什么我看不到# 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')))))

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

1 个答案:

答案 0 :(得分:0)

我不是百分百肯定这是你正在寻找的东西,但这使得一个交通headerPanel显示:

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