首页 > 解决方案 > 使用 Shiny App 中的按钮删除活动标签面板

问题描述

大家好,我很想知道是否可以在闪亮的应用程序上删除当前活动的 tabPanel:

这是我的代码:

  # server
  observeEvent(input$removeTab, priority = 20, {
     removeTab(inputId="sortTab", target=input$ACTIVE_TAB)
  })

  # ui
  actionButton("removeTab", "Remove current tab")

非常感谢你的帮助!

标签: rshinytabpanel

解决方案


Here is the answer. If the tabPanel that we desire to remove is encapsulated in a TabsetPanel, for example in a :

TabsetPanel(id='sortTab', Tabpanel(), Tabpanel() )

We juste have to respecify the TabSetPanel id with the input argument on the target :

  # server
  observeEvent(input$removeTab, priority = 20, {
     removeTab(inputId="sortTab", target=input$sortTab)
  })

  # ui
  actionButton("removeTab", "Remove current tab")

推荐阅读