forked from dreamRs/shinyWidgets
-
Notifications
You must be signed in to change notification settings - Fork 0
/
updateAutonumericInput.Rd
109 lines (101 loc) · 2.59 KB
/
updateAutonumericInput.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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/input-autonumeric.R
\name{updateAutonumericInput}
\alias{updateAutonumericInput}
\title{Update an Autonumeric Input Object}
\usage{
updateAutonumericInput(
session = getDefaultReactiveDomain(),
inputId,
label = NULL,
value = NULL,
options = NULL
)
}
\arguments{
\item{session}{Standard shiny \code{session}.}
\item{inputId}{The id of the input object.}
\item{label}{The label to set for the input object.}
\item{value}{The value to set for the input object.}
\item{options}{List of additional parameters to update, use
\code{autonumericInput}'s arguments.}
}
\description{
Update an Autonumeric Input Object
}
\examples{
if (interactive()) {
library(shiny)
library(shinyWidgets)
ui <- fluidPage(
h1("AutonumericInput Update Example"),
br(),
autonumericInput(
inputId = "id1",
label = "Autonumeric Input",
value = 1234.56,
align = "center",
currencySymbol = "$ ",
currencySymbolPlacement = "p",
decimalCharacter = ".",
digitGroupSeparator = ","
),
verbatimTextOutput("res1"),
actionButton("bttn1", "Change Input to Euros"),
actionButton("bttn2", "Change Input to Dollars"),
br(),
br(),
sliderInput("decimals", "Select Number of Decimal Places",
value = 2, step = 1, min = 0, max = 6),
actionButton("bttn3", "Update Number of Decimal Places")
)
server <- function(input, output, session) {
output$res1 <- renderPrint(input$id1)
observeEvent(input$bttn1, {
updateAutonumericInput(
session = session,
inputId = "id1",
label = "Euros:",
value = 6543.21,
options = list(
currencySymbol = "\u20ac",
currencySymbolPlacement = "s",
decimalCharacter = ",",
digitGroupSeparator = "."
)
)
})
observeEvent(input$bttn2, {
updateAutonumericInput(
session = session,
inputId = "id1",
label = "Dollars:",
value = 6543.21,
options = list(
currencySymbol = "$",
currencySymbolPlacement = "p",
decimalCharacter = ".",
digitGroupSeparator = ","
)
)
})
observeEvent(input$bttn3, {
updateAutonumericInput(
session = session,
inputId = "id1",
options = list(
decimalPlaces = input$decimals
)
)
})
}
shinyApp(ui, server)
}
}
\seealso{
Other autonumeric:
\code{\link{autonumericInput}()},
\code{\link{currencyInput}()},
\code{\link{updateCurrencyInput}()}
}
\concept{autonumeric}