I'm working on building a R Shiny web app to help with data exploration. I have a main page with a row of tabs, and then a row of sub tabs:

I want to have a panel appear that provides different inputs for users to select in order to create different charts (for example, when Bar Chart tab is selected, I'd like to have a dropdown list for the dataset columns, and when Histogram is selected, I'd like to have a slider for number of bins.
I can do this fine with the first level of tabs. For example, this following line of code in my ui.R allows me to easily render a panel whenever Correlation is selected:
conditionalPanel(
condition = "input.tabs == 'correlation'",
actionButton("generate_correlation", "Generate Heat Map")
)
server.R:
tabsetPanel(
id = "tabs",
tabPanel("Correlation", value = "correlation",
plotOutput("correlation"))
... code for other tabs...
However, I can't figure out how to access the value returned by the nested tabPanel (for example, Bar Chart or Histogram). I attempted to use this code:
tabPanel(
"Visualize",
value = "visualize",
tabsetPanel(
id = "vis_tabs",
tabPanel("Bar Chart", value = "bar_tab",# <-- want a conditionalPanel to appear when this tab is selected
plotOutput("bar_chart")),
tabPanel("Histogram", value = "histogram_tab",
plotOutput("histogram"))
)
),
with the following conditionalPanel:
conditionalPanel(
condition = "input.vis_tabs" == "bar_tab",
#CODE HERE FOR INPUT STUFF TO APPEAR WHEN BAR CHART TAB IS SELECTED
),
But right now, the above conditionalPanel is always evaluating to true. This SO post is the closest I could find to an answer, and it really didn't help much since it was focused on display output.
My guess is that since the second-level tab is defined within the scope of the first level tab, the value it returns isn't available in the "global" ui.R or server.R scope. But if that's the case, I'd expect the conditionalPanel to always evaluate to false, while it's currently evaluating to always be true!
I also know that the condition being evaluated is in JavaScript, so would the nested tab condition be something like
input.tabs.vis_tabs == "bar_tab"
? I'm assuming that input is an instance of some Input JS object with tabs being a string property that is dynamically set as the user selects different tabs.
condition = "input.vis_tabs" == "bar_tab"contains a typo ;) Is it solved bycondition = "input.vis_tabs == 'bar_tab' "? Otherwise please provide a reproducible example. - Tonio Liebrand