Last active
October 20, 2016 10:35
-
-
Save markheckmann/8314905 to your computer and use it in GitHub Desktop.
Reset shiny fileInput object (see SO question http://stackoverflow.com/questions/17352086/how-can-i-update-an-shiny-fileinput-object)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
shinyServer(function(input, output, session) { | |
observe({ | |
input$btn | |
session$sendCustomMessage(type = "resetFileInputHandler", "file1") | |
}) | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
shinyUI(bootstrapPage( | |
fileInput('file1', 'Choose File'), | |
actionButton("btn", "Trigger server to reset file input"), | |
tags$script(' | |
Shiny.addCustomMessageHandler("resetFileInputHandler", function(x) { | |
var id = "#" + x + "_progress"; | |
var idBar = id + " .bar"; | |
$(id).css("visibility", "hidden"); | |
$(idBar).css("width", "0%"); | |
}); | |
') | |
)) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello,
thanks for this trick! I was using it for a while, but now it's not working with Shiny 0.14, since they are using different upload button style.