【问题标题】:How do I make dynamic shiny tabs with their own content?如何使用自己的内容制作动态闪亮的标签?
【发布时间】:2015-10-20 15:30:53
【问题描述】:

因此,我查看了以下链接,以便在执行操作时创建动态选项卡并使用自己的侧边栏创建选项卡,但我似乎无法将 2 和 2 放在一起。

R Shiny - add tabPanel to tabsetPanel dynamically (with the use of renderUI)

Are tabs with their own sidebars and mainPanels possible in shiny?

有谁知道动态创建标签后如何访问它们?此外,在这种情况下,renderUI 示例是否不好,因为它会为每个操作创建一个新的标头列表?

【问题讨论】:

    标签: r user-interface shiny


    【解决方案1】:

    我要感谢 stackoverflow 的所有好心人帮助我解决了这个问题;这是对编程初学者最支持的网站。

    用户界面:

    library(shiny)
    shinyUI(navbarPage("TiGr",
    
                   tabPanel("File Input Page",
                            fluidPage("Input")),
    
                   tabPanel("Summary Statistics and Plots",
                            fluidPage("Statistics")),
    
                   tabPanel("Time Clusters",
                            fluidPage("cluster"),
                            actionButton("subClust", label = "Create Subcluster"),
                            uiOutput("tabs"),
                            conditionalPanel(condition="input.level==1",
                                             helpText("test work plz")
                            ), 
                            conditionalPanel(condition="input.level==5",
                                             helpText("hohoho")
                            )
                   )
    ))
    

    服务器:

    library(shiny)
    
    shinyServer(function(input, output,session) {
      output$tabs=renderUI({
    
    Tabs<-as.list(rep(0,input$subClust+1))
    for (i in 0:length(Tabs)){
      Tabs[i]=lapply(paste("Layer",i,sep=" "),tabPanel,value=i)
    }
    
    #Tabs <- lapply(paste("Layer",0:input$subClust,sep=" "), tabPanel)
    do.call(tabsetPanel,c(Tabs,id="level"))
    })
    }
    )
    

    【讨论】:

    • 在时间集群选项卡下,您可以单击以制作更多子选项卡,在第一个和第五个选项卡上您将收到我的自定义消息
    猜你喜欢
    • 2017-11-26
    • 2018-01-09
    • 1970-01-01
    • 1970-01-01
    • 2019-02-22
    • 1970-01-01
    • 2019-03-15
    • 2021-07-28
    • 2015-10-06
    相关资源
    最近更新 更多