So I've looked at the following links to make dynamic tabs when I perform an action and to create tabs with their own sidebars, but I can't seem to put 2 and 2 together.
R Shiny - add tabPanel to tabsetPanel dynamically (with the use of renderUI)
Are tabs with their own sidebars and mainPanels possible in shiny?
Does anyone know how to access the tabs after you dynamically create them? Also, is the renderUI example bad in this case because it creates a new list of headers with every action?
I would like to thank all the good people over at stackoverflow for aiding me in solving this problem; this is the most supportive site for programming beginners out there.
UI:
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")
)
)
))
Server:
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"))
})
}
)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With