Skip to content

Instantly share code, notes, and snippets.

@markheckmann
Last active October 20, 2016 10:35
Show Gist options
  • Save markheckmann/8314905 to your computer and use it in GitHub Desktop.
Save markheckmann/8314905 to your computer and use it in GitHub Desktop.
shinyServer(function(input, output, session) {
observe({
input$btn
session$sendCustomMessage(type = "resetFileInputHandler", "file1")
})
})
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%");
});
')
))
@tomasreigl
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment