Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

menuItem( ) do not collapse when using renderMenu( ) #321

Open
srgmld opened this issue Nov 23, 2022 · 1 comment
Open

menuItem( ) do not collapse when using renderMenu( ) #321

srgmld opened this issue Nov 23, 2022 · 1 comment
Labels
duplicate This issue or pull request already exists

Comments

@srgmld
Copy link

srgmld commented Nov 23, 2022

When creating a dynamic menu which render on the server using renderMenu( ) function, the menuItem( ) with menuSubItem( ) does not respond to the collapse action.

Once the menuItem( ) is expanded it is not possible to collapse it.

Any suggestions?

ui <-  dashboardPage(
  title = "Indicadores",
  header = dashboardHeader(
    title = dashboardBrand(
      title = "Terminales",
      color = "primary"
    )
  ),
  sidebar = dashboardSidebar( 
    sidebarMenu(id = "login",
                menuItem(
                  "Login",
                  tabName = "login",
                  icon = icon("key")
                )
    ),
    sidebarMenuOutput("menu") ### Menu principal ----
    
  ),
  ## Body ----
  
  body = dashboardBody(
    tabItems(
      tabItem(tabName = "login"
      ),
      ###  Formacion Trenes ----
      tabItem(
        tabName = "panel1_1"#,
        # param_panel1_1
      ),
      ### Producción Terminales  ----
      tabItem(
        tabName = "panel2"#,
        # param_panel2
      ),
      tabItem(
        tabName = "panel2_2"#,
        # param_panel2_2
      ),
      tabItem(
        tabName = "panel2_3"#,
        # param_panel2_3
      ),
      tabItem(
        tabName = "panel2_4"#,
        # param_panel2_4
      ),
      tabItem(
        tabName = "panel3"#,
        # param_panel3
      )
    )
  )
)

# SERVER ----

server <- function(input, output, session) {
 
  
  output$menu <- renderMenu({
    sidebarMenu(
      id = "sidebarmenu",
      sidebarHeader("Datos"),
      menuItem(
        "Formación",
        icon = icon("train"),
        tabName = "panel1_1"
      ),
      menuItem(
        "Producción Terminales",
        icon = icon("list"),
        # tabName = "panel2"
        # startExpanded = TRUE,
        # collapsible = TRUE,
        menuSubItem(
          text = "Selección Día",
          tabName = "panel2",
          icon = icon("calendar")
        ),
        menuSubItem(
          text = "Clientes",
          tabName = "panel2_2",
          icon = icon("group")
        ),
        menuSubItem(
          text = "Productos",
          tabName = "panel2_3",
          icon = icon("lemon")
        ),
        menuSubItem(
          text = "Terminales",
          tabName = "panel2_4",
          icon = icon("signs-post")
        )
      ),
      menuItem(
        "Finanzas",
        icon = icon("money-bill"),
        tabName = "panel3"
      )

    )
  })
  
  
}

shinyApp(ui, server)
@adisarid
Copy link

Related to #314

@DivadNojnarg DivadNojnarg added the duplicate This issue or pull request already exists label Jan 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

3 participants