| 1 |
% Generated by roxygen2: do not edit by hand |
| 2 |
% Please edit documentation in R/update-input.R |
| 3 |
\name{updateDateRangeInput} |
| 4 |
\alias{updateDateRangeInput} |
| 5 |
\title{Change the start and end values of a date range input on the client} |
| 6 |
\usage{ |
| 7 |
updateDateRangeInput( |
| 8 |
session = getDefaultReactiveDomain(), |
| 9 |
inputId, |
| 10 |
label = NULL, |
| 11 |
start = NULL, |
| 12 |
end = NULL, |
| 13 |
min = NULL, |
| 14 |
max = NULL |
| 15 |
) |
| 16 |
} |
| 17 |
\arguments{ |
| 18 |
\item{session}{The \code{session} object passed to function given to |
| 19 |
\code{shinyServer}. Default is \code{getDefaultReactiveDomain()}.} |
| 20 |
|
| 21 |
\item{inputId}{The id of the input object.} |
| 22 |
|
| 23 |
\item{label}{The label to set for the input object.} |
| 24 |
|
| 25 |
\item{start}{The initial start date. Either a Date object, or a string in |
| 26 |
\code{yyyy-mm-dd} format. If NULL (the default), will use the current |
| 27 |
date in the client's time zone.} |
| 28 |
|
| 29 |
\item{end}{The initial end date. Either a Date object, or a string in |
| 30 |
\code{yyyy-mm-dd} format. If NULL (the default), will use the current |
| 31 |
date in the client's time zone.} |
| 32 |
|
| 33 |
\item{min}{The minimum allowed date. Either a Date object, or a string in |
| 34 |
\code{yyyy-mm-dd} format.} |
| 35 |
|
| 36 |
\item{max}{The maximum allowed date. Either a Date object, or a string in |
| 37 |
\code{yyyy-mm-dd} format.} |
| 38 |
} |
| 39 |
\description{ |
| 40 |
Change the start and end values of a date range input on the client |
| 41 |
} |
| 42 |
\details{ |
| 43 |
The input updater functions send a message to the client, telling it to |
| 44 |
change the settings of an input object. The messages are collected and sent |
| 45 |
after all the observers (including outputs) have finished running. |
| 46 |
|
| 47 |
The syntax of these functions is similar to the functions that created the |
| 48 |
inputs in the first place. For example, \code{\link{numericInput}()} and |
| 49 |
\code{updateNumericInput()} take a similar set of arguments. |
| 50 |
|
| 51 |
Any arguments with NULL values will be ignored; they will not result in any |
| 52 |
changes to the input object on the client. |
| 53 |
|
| 54 |
For \code{\link{radioButtons}()}, \code{\link{checkboxGroupInput}()} and |
| 55 |
\code{\link{selectInput}()}, the set of choices can be cleared by using |
| 56 |
\code{choices=character(0)}. Similarly, for these inputs, the selected item |
| 57 |
can be cleared by using \code{selected=character(0)}. |
| 58 |
} |
| 59 |
\examples{ |
| 60 |
## Only run examples in interactive R sessions |
| 61 |
if (interactive()) { |
| 62 |
|
| 63 |
ui <- fluidPage( |
| 64 |
sliderInput("n", "Day of month", 1, 30, 10), |
| 65 |
dateRangeInput("inDateRange", "Input date range") |
| 66 |
) |
| 67 |
|
| 68 |
server <- function(input, output, session) { |
| 69 |
observe({ |
| 70 |
date <- as.Date(paste0("2013-04-", input$n)) |
| 71 |
|
| 72 |
updateDateRangeInput(session, "inDateRange", |
| 73 |
label = paste("Date range label", input$n), |
| 74 |
start = date - 1, |
| 75 |
end = date + 1, |
| 76 |
min = date - 5, |
| 77 |
max = date + 5 |
| 78 |
) |
| 79 |
}) |
| 80 |
} |
| 81 |
|
| 82 |
shinyApp(ui, server) |
| 83 |
} |
| 84 |
} |
| 85 |
\seealso{ |
| 86 |
\code{\link[=dateRangeInput]{dateRangeInput()}} |
| 87 |
} |