I have developed a rshiny dashboard. For the layout, I utilized the bs4Dash package, which includes a sidebar menu. The (simplified) dashboard consists of two tab items. Within the second tab item, I have added a bookmark button and a radio button.
The issue I'm encountering is that when I attempt to use the bookmark functionality, the state_id and input.rds file are generated successfully. However, when I try to load the aaplication using the state_id URL, the dashboard does not open on the correct tab item. Although the radioButton does change to the bookmark, the tab ID does not.
Does anybody have any suggestions or solutions on how to get the sidebarmenu to change when loaded with a state_id url?
Thanks in advance!
I created the following example code:
#loading libraries
library(shiny)
library(bs4Dash)
#enabling shinybookmarks
enableBookmarking("server")
#defining ui
ui <- function() {
dashboardPage(
dashboardHeader(),
dashboardSidebar(
sidebarMenu(
id = "tabs",
menuItem(
text = "Tab 1",
tabName = "tab1"
),
menuItem(
text = "Tab 2",
tabName = "tab2"
)
)
),
dashboardBody(
tabItems(
tabItem(
tabName = "tab1",
h1("tab 1")
),
tabItem(
tabName = "tab2",
h1("Tab 2"),
bookmarkButton(label = "Bookmark!"),
radioButtons("bttn", "A radio button", choices = c("A", "B", "C", "D"), selected = "A")
)
)
)
)
}
#defining server
server <- function(input, output) {
setBookmarkExclude(c("dark_mode","customSwitch1", "sidebarId", "sidebarItemExpanded"))
}
#running shinyapp
shinyApp(ui = ui, server = server)