In my main panel I have two tabs, one with a table, and one with a graph. The table tab is the default view, so when the user clicks on the actionButton titled "Graph" they currently then have to click on the "Graph" tab to view the results. I would like to have the actionButton automatically change focus to the Graph tab, but I am unable to find any documentation on how to access the output from the actionButton for the purpose.
library(shiny)
# Define the overall UI
shinyUI(fluidPage(
titlePanel("A.inornata gene expression during tail regeneration"),
sidebarPanel(
selectInput(inputId="measure", label="Select measurement:",
choices = c("CPM by time point", "RPKM by time point", "CPM by sample", "RPKM by sample")),
textInput(inputId="comp", label="Enter contig to graph:", value=""),
helpText("To graph expression, enter the gene name and description here, then click the 'graph' button."),
actionButton(inputId="graph.button", label="Graph", icon=NULL)
),#end sidepanel
mainPanel(
tabsetPanel(id="tabs",
tabPanel(title="Table", value="panel1", dataTableOutput(outputId="table")),
tabPanel(title="Graph", value="panel2", plotOutput("graph")))
)
))
observe({
#this doesn't even begin to work
if input$graph.button == TRUE {
updateTabsetPanel(session, "tabs", selected = "panel2")
} else {
updateTabsetPanel(session, "tabs", selected = "panel1")
}
})