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

Add ability to restore bookmarked tabs #157

Merged
merged 3 commits into from
Sep 13, 2016
Merged

Add ability to restore bookmarked tabs #157

merged 3 commits into from
Sep 13, 2016

Conversation

wch
Copy link
Contributor

@wch wch commented Sep 13, 2016

This closes #152.

It adds the ability to restore selected menuItems and menuSubItems in the sidebar if they have a corresponding tabItem. However, menuSubItems still don't have the ability to start expanded at this time, so although the tab content will be visible, the menuSubItem itself will not be.

Simple test app:

library(shiny)

ui <- function(request) {
  sidebar <- dashboardSidebar(
    sidebarMenu(id = "sidebarmenu",
      menuItem("Dashboard", tabName = "dashboard", icon = icon("dashboard")),
      menuItem("Subitems",
        menuSubItem("Subitem 1", "subitem1"),
        menuSubItem("Subitem 2", "subitem2")
      ),
      menuItem("Widgets", icon = icon("th"), tabName = "widgets",
               badgeLabel = "new", badgeColor = "green"),
      bookmarkButton()
    )
  )

  body <- dashboardBody(
    tabItems(
      tabItem(tabName = "dashboard",
        h2("Dashboard tab content")
      ),
      tabItem(tabName = "subitem1",
        h2("Subitem 1 tab content")
      ),
      tabItem(tabName = "subitem2",
        h2("Subitem 2 tab content")
      ),

      tabItem(tabName = "widgets",
        h2("Widgets tab content")
      )
    )
  )

  dashboardPage(
    dashboardHeader(title = "Simple tabs"),
    sidebar,
    body
  )
}
server <- function(input, output) { }

shinyApp(ui, server, enableBookmarking = "url")

@wch wch merged commit 69b809a into master Sep 13, 2016
@wch wch deleted the restore-tabs branch September 13, 2016 20:05
dmpe pushed a commit to dmpe/shinydashboard that referenced this pull request Mar 25, 2017
Add ability to restore bookmarked tabs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Need support for restoring tabs
1 participant