我想將通知鏈接到(內部)選項卡。將通知鏈接到shinydashboard中的選項卡
要做到這一點我就翻過這一點:How to use href in shiny notificationItem?
這似乎是應用程序的加載後工作權,但在工具條中一些導航後鏈接不工作了。
ui.R
library(shiny)
library(shinydashboard)
notification <- notificationItem(icon = icon("exclamation-triangle"), status = "danger", paste0("noti"))
notification$children[[1]] <- a(href="#shiny-tab-dashboard","data-toggle"="tab", "data-value"="dashboard",list(notification$children[[1]]$children))
header <- dashboardHeader(dropdownMenu(notification), title = "Dashboard")
sidebar <- dashboardSidebar(
sidebarMenu(
menuItem("Dashboard", tabName = "dashboard", icon = icon("dashboard")),
menuItem("Test",
menuSubItem("test1", tabName = "test1", href = NULL, newtab = TRUE,
icon = shiny::icon("angle-double-right"), selected = F),
menuSubItem("test2", tabName = "test2", href = NULL, newtab = TRUE,
icon = shiny::icon("angle-double-right"), selected = T)
)
)
)
body <- dashboardBody(
tabItems(
tabItem(tabName = "dashboard",
h2("Dashboard tab content")
),
tabItem(tabName = "test1",
h2("Widgets tab1 content")
),
tabItem(tabName = "test2",
h2("Widgets tab2 content")
)
)
)
dashboardPage(
header,
sidebar,
body
)
server.R
function(input, output) {
}
嗯..考察更多一點這一點。在檢查html時,兩個hrefs看起來都是相同的: