【发布时间】:2019-01-24 07:18:27
【问题描述】:
我正在寻找一种从 HTML 文本(嵌套在服务器部分中)链接到特定 Shiny tabPanel(嵌套在 UI 中)的方法。假设我们有以下应用:
library(shiny)
shinyUI(fluidPage(
sidebarLayout(
mainPanel(
tabsetPanel(
type="tabs",
tabPanel("Contents", htmlOutput("contents")),
tabPanel("Plot", plotOutput("plot")) # <- A link to here
)
)
)
))
shinyServer(function(input, output) {
output$contents <- renderText({
HTML("A link to <a href='#Plot'>Plot</a>") # <- from there
})
output$plot({
some ggplot
})
})
如何在文本中创建一个链接,然后重定向到某个选项卡。我尝试了锚标记,但它们似乎不起作用,因为每次启动应用程序时 id 都会不断变化。
提前致谢。
【问题讨论】: