I am working with sidebarPanel using navbarPage.
I would like to โdeclareโ only one widget (radioButtons in this example), and then bind each tab to the โmainโ sidebarPanel. As you can see, tab2 does not respond to relative radioButtons. The structure of my project is more complex, having to have the same sidebarPanel for some tabs and a separate sidebarPanel for some other tabs. This is the code I'm using:
library(shiny) server=function(input, output) { output$plot1 = renderPlot({plot(runif(input$rb))}) output$plot2 = renderPlot({plot(runif(input$rb))}) } ui = shinyUI(navbarPage("Test multi page", tabPanel("tab1", sidebarLayout( sidebarPanel( radioButtons("rb","Nr of obs:",choices = c("50 obs"=50,"300 obs"=300)) ), mainPanel(plotOutput("plot1")) ) ), tabPanel("tab2", sidebarLayout( sidebarPanel( radioButtons("rb","Nr of obs:",choices = c("50 obs"=50,"300 obs"=300)) ), mainPanel(plotOutput("plot2")) ) ) )) shinyApp(ui = ui, server = server) runApp("app")
source share