我正在尝试将 updateTabsetPanel 与 R Shiny 中的传单标记单击集成,但在 tabsetPanel 中引用了 tabsetPanel

问题描述

我试图在 Trying to integrate updateTabsetPanel with leaflet marker click in R Shiny? 处扩展@SBista 的答案,以便我的传单地图上的链接用户重定向到嵌套在两个先前 tabsetPanel 中的 tabPanel(例如:first > second > gust 或第一个>第二个>顺式)。我可以使链接正常工作,但它只会将我重定向到第二个 tabsetpanel 中的第一个 tabpanel,而不会选择所需的 tabpanel。我已经在下面的代码中重构了我想要发生的事情。理想情况下会有一张带有多个标记的地图。单击标记时,将出现一个带有超链接的弹出窗口。单击超链接时,用户将被重定向到包含所选站点信息的 TabsetPanel“second”中的 tabPanel。任何帮助将不胜感激!

shinyServer(function(input,output,session) {
output$distribution_map <- renderLeaflet({
distribution_map <- leaflet() %>%
  addProviderTiles(providers$Esri.NatGeoWorldMap) %>%
  setView(lng =-122.280649,lat = 46.560582,zoom = 10) %>%
  addMarkers(icon = mapIcons$fish_truck,lng = -122.280649,label = lapply(gust_backstrom_release_labels,HTML),clusterOptions = markerClusterOptions(),group = "Adult Release Sites",labelOptions = labelOptions(textsize = "100%",style = list(
                                           "color" = "black","font-family" = "serif","Box-shadow" = "5px 5px rgba(0,0.25,0.25)","border-color" = "rgba(0,0.5)")),popup = paste(sep = "<br/>",actionLink("?url=first/gust","Learn about Gust Backstrom",onclick = 'Shiny.onInputChange(\"link_click\",Math.random())') %>%
addMarkers(icon = mapIcons$fish_truck,label = lapply(cispus_release_labels,actionLink("?url=first/cis","Learn about Cispus",onclick = 'Shiny.onInputChange(\"link_click2\",Math.random())')
})
    observeEvent(input$link_click,{
      updateTabsetPanel(session,"second","gust")
    })
    observeEvent(input$link_click2,"cis")
    })
}
ui <- tabsetPanel(id = "first",tabPanel(value = "map",leafletoutput("destination_map")),tabPanel(value = "sites",tabsetPanel(id = "second",tabPanel(value = "gust","Gust Backstrom",h1("Here is the Gust Backstrom data")),tabPanel(value = "cis","Cispus",h1("Here is the Cispus data")))

shinyApp(ui = ui,server = server)


解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...