-
Notifications
You must be signed in to change notification settings - Fork 1.9k
/
updateTabsetPanel.Rd
72 lines (65 loc) · 1.77 KB
/
updateTabsetPanel.Rd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/update-input.R
\name{updateTabsetPanel}
\alias{updateTabsetPanel}
\alias{updateNavbarPage}
\alias{updateNavlistPanel}
\title{Change the selected tab on the client}
\usage{
updateTabsetPanel(
session = getDefaultReactiveDomain(),
inputId,
selected = NULL
)
updateNavbarPage(
session = getDefaultReactiveDomain(),
inputId,
selected = NULL
)
updateNavlistPanel(
session = getDefaultReactiveDomain(),
inputId,
selected = NULL
)
}
\arguments{
\item{session}{The \code{session} object passed to function given to
\code{shinyServer}. Default is \code{getDefaultReactiveDomain()}.}
\item{inputId}{The id of the \code{tabsetPanel}, \code{navlistPanel},
or \code{navbarPage} object.}
\item{selected}{The \code{value} (or, if none was supplied, the \code{title})
of the tab that should be selected by default. If \code{NULL}, the first
tab will be selected.}
}
\description{
Change the selected tab on the client
}
\examples{
## Only run examples in interactive R sessions
if (interactive()) {
ui <- fluidPage(sidebarLayout(
sidebarPanel(
sliderInput("controller", "Controller", 1, 3, 1)
),
mainPanel(
tabsetPanel(id = "inTabset",
tabPanel(title = "Panel 1", value = "panel1", "Panel 1 content"),
tabPanel(title = "Panel 2", value = "panel2", "Panel 2 content"),
tabPanel(title = "Panel 3", value = "panel3", "Panel 3 content")
)
)
))
server <- function(input, output, session) {
observeEvent(input$controller, {
updateTabsetPanel(session, "inTabset",
selected = paste0("panel", input$controller)
)
})
}
shinyApp(ui, server)
}
}
\seealso{
\code{\link[=tabsetPanel]{tabsetPanel()}}, \code{\link[=navlistPanel]{navlistPanel()}},
\code{\link[=navbarPage]{navbarPage()}}
}