Shinydashboard:是否不能有嵌套的菜单子项?不能让它工作
Shinydashboard: Is it not possible to have nested menu sub items? Can't make it work
我正在使用 shinydashboard,需要构建两级嵌套子菜单。我正在尝试这个但行不通:
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
是否可以构建两层嵌套?当然,删除上面的 l
和 m
子菜单就可以了(有一级子菜单)。
如果你只使用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'))
)))
我正在使用 shinydashboard,需要构建两级嵌套子菜单。我正在尝试这个但行不通:
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
是否可以构建两层嵌套?当然,删除上面的 l
和 m
子菜单就可以了(有一级子菜单)。
如果你只使用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'))
)))