Do you know how to have a nested appendTab in R. I want to be able to append the tabs with one for loop and in each tab I append other tabs with another for loop.
Thank you for your answers
library(shiny)
ui <- fluidPage(
column(
3,
box(
title = "Validation studies",
actionButton("add", "add tab"),
width = 12
)
),
column(
9,
box(
title = "Validation studies",
tabsetPanel(id = ns("tabs")),
width = 12
)
)
)
server <- function(input, output, session) {
n <- 0
observeEvent(input$add, {
n <<- n + 1
appendTab(inputId = "tabs",
tab = tabPanel(title = "Test",
box(
tabsetPanel(id = ns(paste0("tabs_", n))),
width = 12
)
),
select = TRUE
)
for(i in 1:3){
print(i)
appendTab(inputId=paste0("tabs_",n),
tabsetPanel(
tabPanel(
"Dynamic",
paste("Content for dynamic tab", i)
)
)
)
}
})
}
shinyApp(ui, server)
But I get Warning: Error in ns: function "ns" could not found [No stack trace available]