Switching from a tab to another one (shinydashboard)

952 views
Skip to first unread message

mbh

unread,
Apr 13, 2015, 10:20:20 AM4/13/15
to shiny-...@googlegroups.com
Hello,

I'm trying to switch from a tab to another on by clicking a button. I almost succeeded, i just need to highlight the "good" tab in the sidebar. Any hint ?

library(shiny)
library
(shinydashboard)


server
= function(input, output) {
  output$button
<- renderUI({
    tags$button
("Click to switch tab", "class"="btn btn-default action-button",
               
"data-toggle"="tab", "href"="#shiny-tab-tab2")
 
})
}


ui
= dashboardPage(
  dashboardHeader
(),
  dashboardSidebar
(
    sidebarMenu
(
      menuItem
("Tab1", tabName = "tab1"),
      menuItem
("Tab2", tabName = "tab2"))
 
),
  dashboardBody
(
    tabItems
(
      tabItem
("tab1",uiOutput("button")),
      tabItem
("tab2", "tab2", "Done !")
   
)
 
)
)
runApp
(list(ui=ui,server=server))

Thanks for helping,
Matthieu

gjabel

unread,
Jun 15, 2015, 5:24:47 AM6/15/15
to shiny-...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages