Hi all,
is there a way to make the tabs interactive/Dynamic. For example, in the below example, suppose if Mycars did not have any data, then "MTCARS" tabs should not be shown. Similarly for Iris as well?
library(shiny)
library(DT)
runApp(list(
ui = pageWithSidebar(
headerPanel('Dynamic Tabs'),
sidebarPanel(
numericInput("nTabs", 'No. of Tabs', 5)
),
mainPanel(
tabsetPanel(
tabPanel(
"IRIS",DT::dataTableOutput('iris_table')
),
tabPanel(
"MTCARS",DT::dataTableOutput('mtcars_table')
)
)
)
),
server = function(input, output, session){
output$iris_table <- DT::renderDataTable(
DT::datatable(head(iris))
)
output$mtcars_table <- DT::renderDataTable(
DT::datatable(head(mtcars))
)
}
))