【发布时间】:2016-03-01 16:47:43
【问题描述】:
我想将通知链接到(内部)选项卡。
为此,我遇到了这个: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
)
服务器.R
function(input, output) {
}
【问题讨论】:
-
嗯.. 对此进行了更多调查。检查 html 时,两个 href 似乎是相同的: 对于 menuItem 它是 仪表板不要指望这是原因(因为它在启动后立即工作)。想法仍然受到高度赞赏!
标签: r shiny shinydashboard