Skip to content

Instantly share code, notes, and snippets.

@jcheng5
Last active August 29, 2015 14:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jcheng5/5427d6f264408abf3049 to your computer and use it in GitHub Desktop.
Save jcheng5/5427d6f264408abf3049 to your computer and use it in GitHub Desktop.
Link directly to specific tab. Add ?tab=3 to the URL to jump straight to tab3, for example.
shinyServer(function(input, output, session) {
# On startup, read the URL parameter
queryParams <- parseQueryString(isolate(session$clientData$url_search))
if ('tab' %in% names(queryParams))
updateTabsetPanel(session, 'tabset', selected = paste0('tab', queryParams[['tab']]))
})
shinyUI(fluidPage(
tabsetPanel(id = "tabset",
tabPanel(value = "tab1", "One"),
tabPanel(value = "tab2", "Two"),
tabPanel(value = "tab3", "Three")
)
))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment