Make fileInput trigger shiny:inputchanged. Closes #1511

This commit is contained in:
Winston Chang
2017-01-17 13:13:50 -05:00
parent c8ed6544db
commit 5cd9ba609a
2 changed files with 11 additions and 0 deletions

View File

@@ -18,6 +18,8 @@ in shiny apps. For more info, see the documentation (`?updateQueryString` and `?
### Bug fixes
* Fixed ([#1511](https://github.com/rstudio/shiny/issues/1511)): `fileInput`s did not trigger the `shiny:inputchanged` event on the client. ([#1541](https://github.com/rstudio/shiny/pull/1541))
### Library updates
* Closed ([#1500](https://github.com/rstudio/shiny/issues/1500)): Updated ion.rangeSlider to 2.1.6. ([#1540](https://github.com/rstudio/shiny/pull/1540))

View File

@@ -81,6 +81,15 @@ $.extend(FileUploader.prototype, FileProcessor.prototype);
function(error) {
self.onError(error);
});
// Trigger shiny:inputchanged. Unlike a normal shiny:inputchanged event,
// it's not possible to modify the information before the values get
// sent to the server.
var evt = jQuery.Event("shiny:inputchanged");
evt.name = this.id;
evt.value = fileInfo;
evt.inputType = '';
$(document).trigger(evt);
};
this.onFile = function(file, cont) {
var self = this;