Two sidebar menu items pointing to same tab

shinydashboard

#1

I have 2 sidebar menuitems A and B. when i click on a menuitem it should change the values in the page.


#2

Hi @anvesh2953,

It’s not clear from your question what the problem/your desired behavior is.

It’s much easier to answer questions about code with code, so if you could include reprex (short for reproducible example), that would help us help you.

If you’ve never heard of a reprex before, you might want to start by reading the tidyverse.org help page.

You might also want to take a look at the Shiny user interface tutorial, which covers sidebar navigation:
https://shiny.rstudio.com/tutorial/written-tutorial/lesson2/


#3
dashboardSidebar(
                      sidebarMenu( id="tabs",
                        menuItem("Stationary", tabName = "l", icon = icon("th"),
                                 menuSubItem('LTE',
                                             tabName = "STALTE",
                                             icon = icon("dashboard")),
                                 menuSubItem('UMTS',
                                             tabName = "STAUMTS",
                                             icon = icon("dashboard"))         
                        )
                        
                      )
                    ) 

dashboardBody(
        tabItems(
                  tabItem(tabName = "STALTE",
                   fluidPage(fluidRow(verbatimTextOutput("default")
                 )
             )
.......
.......

tabItem(tabName = "STALTE",
        fluidPage(fluidRow(verbatimTextOutput("default")
        ))

server <- function(input, output,session){

output$default<-renderText({
  if(input$tabs=='STAUMTS'){" Stationary LTE"}
  else if(input$tabs=='STALTE'){" Stationary UMTS"}
  else{""}
  
})
}

I need to change output$default based on tab selected. i want to use sidebar menu item like a radio button. I would like to stay on the tab STALTE when i click on the tab STAUMTS and see the change in output$default from Stationary LTE to Stationary UMTS. Hope it is clear…