I am using a shinydashboard, and have a need to build two-level nested sub menus. I am trying this and won't work:
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'))
)))
Gives me error:
Error in menuSubItem("b", tabName = "b", icon = icon("line-chart"), menuSubItem("l", :
Can't specify both href and tabName
Is it possible to build two-level nesting? Of course, removing l and m sub menus above works just fine (with one level sub menus).
It works if you only use menuSubItem as the lowest level, and call the others menuItem. Will that work for your purposes?
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'))
)))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With