【问题标题】:Shinydashboard: Is it not possible to have nested menu sub items? Can't make it workShinydashboard:不能有嵌套的菜单子项吗?不能让它工作
【发布时间】:2016-10-02 12:03:21
【问题描述】:

我正在使用闪亮仪表板,并且需要构建两级嵌套子菜单。我正在尝试这个,但不会工作:

library(shinydashboard)
sidebar <- dashboardSidebar(
  sidebarMenu(id = 'sidebarmenu',
              menuItem('x', tabName = 'x', icon = icon('line-chart')),
              menuItem('y', tabName = 'y',
                       icon = icon('line-chart'),
                       menuSubItem('a',
                                   tabName = 'a',
                                   icon = icon('line-chart')),
                       menuSubItem('b',
                                   tabName = 'b',
                                   icon = icon('line-chart'),
                                   menuSubItem('l',
                                               tabName = 'l',
                                               icon = icon('line-chart')),
                                   menuSubItem('m',
                                               tabName = 'm',
                                               icon = icon('line-chart'))),
                       menuSubItem('c',
                                   tabName = 'c',
                                   icon = icon('line-chart'))
              )))

给我错误:

Error in menuSubItem("b", tabName = "b", icon = icon("line-chart"), menuSubItem("l",  : 
  Can't specify both href and tabName

是否可以构建两级嵌套?当然,删除上面的lm 子菜单就可以了(只有一级子菜单)。

【问题讨论】:

    标签: r shiny shinydashboard


    【解决方案1】:

    如果你只使用menuSubItem作为最低级别,它可以工作,并调用其他menuItem。这对您的目的有用吗?

    sidebar <- dashboardSidebar(
    sidebarMenu(id = 'sidebarmenu',
                menuItem('x', tabName = 'x', icon = icon('line-chart')),
                menuItem('y', tabName = 'y',
                         icon = icon('line-chart'),
                         menuItem('a',
                                     tabName = 'a',
                                     icon = icon('line-chart')),
                         menuItem('b',
                                     tabName = 'b',
                                     icon = icon('line-chart'),
                                     menuSubItem('l',
                                                 tabName = 'l',
                                                 icon = icon('line-chart')),
                                     menuSubItem('m',
                                                 tabName = 'm',
                                                 icon = icon('line-chart'))),
                         menuItem('c',
                                     tabName = 'c',
                                     icon = icon('line-chart'))
                )))
    

    【讨论】:

      猜你喜欢
      • 2019-02-04
      • 2021-09-25
      • 2012-09-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多