-
-
Notifications
You must be signed in to change notification settings - Fork 118
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
reset does not work for fileInput() when inputId contains a dot "." #140
Comments
Thank you for the report
…On Aug 8, 2017 4:09 AM, "thothal" ***@***.***> wrote:
Consider this MRE:
library(shiny)
library(shinyjs)
ui <- fluidPage(
useShinyjs(),
fileInput("update.File", "Choose File:"),
actionButton("cancel", "Cancel"),
fileInput("updateFile", "Choose File:"),
actionButton("cancel2", "Cancel")
)
server <- function(input, output, session) {
observeEvent(input$cancel, reset("update.File")) #won't work
observeEvent(input$cancel2, reset("updateFile")) #works
}
runApp(shinyApp(ui, server))
The reset for update.File does not work, while it does work for updateFile
.
I tested reset with all inputs mentioned in the documentation and the
problem with the dot occurs only for fileInput elements:
library(shiny)
library(shinyjs)
elems <- c("textInput", "numericInput", "sliderInput", "selectInput",
"selectizeInput", "radioButtons", "dateInput", "dateRangeInput",
"checkboxInput", "checkboxGroupInput", "passwordInput",
"textAreaInput", "fileInput")
defaults <- list(textInput = list(label = "Text Label:", value = "start"),
numericInput = list(label = "Numeric Label:",
value = 5, min = 0, max = 10),
sliderInput = list(label = "Slider Label:",
min = 0, max = 10, value = 2:6),
selectInput = list(label = "Select Label:",
choices = paste("Choice", 1:3)),
selectizeInput = list(label = "Selectize Label:",
choices = paste("Choice", 1:3)),
radioButtons = list(label = "Radio Label:",
choices = paste("Chocie", 1:3)),
dateInput = list(label = "Date Label:", value = "2017-01-06",
min = "2017-01-01", max = "2018-12-31"),
dateRangeInput = list(label = "Date Range Label:",
start = "2017-06-01", end = "2017-07-01",
min = "2017-01-01", max = "2018-12-31"),
checkboxInput = list(label = "Checkbox Label:", value = TRUE),
checkboxGroupInput = list(label = "Checkboxgroup Label:",
choices = paste("Chocie", 1:3)),
passwordInput = list(label = "Password Label:", "start"),
textAreaInput = list(label = "Text Area Label:", value = "start"),
fileInput = list(label = "File Label:"))
CancelUI <- function(id, el = elems) {
ns <- NS(id)
el <- match.arg(el, elems)
def <- defaults[[el]]
tagList(h2(el),
do.call(el, c(def, inputId = ns("Name.With.Dot"))),
actionButton(ns("cancelDot"), "Cancel Dot"),
do.call(el, c(def, inputId = ns("NameWithOutDot"))),
actionButton(ns("cancelNoDot"), "Cancel No Dot"))
}
Cancel <- function(input, output, session) {
observeEvent(input$cancelDot, reset("Name.With.Dot"))
observeEvent(input$cancelNoDot, reset("NameWithOutDot"))
}
ui <- fluidPage(useShinyjs(), lapply(elems, function(n) CancelUI(n, n)))
server <- function(input, output, session) {
handler <- lapply(elems, function(n) callModule(Cancel, n))
}
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#140>, or mute the thread
<https://github.com/notifications/unsubscribe-auth/AA6IFEipYdJNIeLXywkrEy42fpJkoFIJks5sWBe7gaJpZM4OwYya>
.
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Consider this MRE:
The
reset
forupdate.File
does not work, while it does work forupdateFile
.I tested
reset
with all inputs mentioned in the documentation and the problem with the dot occurs only forfileInput
elements:The text was updated successfully, but these errors were encountered: