Implement set_value() to accept a list of files, which triggers the async upload and callbacks

This commit is contained in:
Nathan Gray 2013-08-27 17:20:08 +00:00
parent ccab8e0ac1
commit 4e2843b4a1

View File

@ -268,7 +268,11 @@ var et2_file = et2_inputWidget.extend(
}, },
/** /**
* You can't actually set value, but clearing works * Set the value of the file widget.
*
* If you pass a FileList or list of files, it will trigger the async upload
*
* @param {FileList|File[]|false} value List of files to be uploaded, or false to reset.
*/ */
set_value: function(value) { set_value: function(value) {
if(!value || typeof value == "undefined") if(!value || typeof value == "undefined")
@ -287,14 +291,10 @@ var et2_file = et2_inputWidget.extend(
return; return;
} }
/* if(typeof value == 'object' && value.length && typeof value[0] == 'object' && value[0].name)
// This would only look like it worked
var i = 0;
for(var key in value)
{ {
this.createStatus(null,value.name,i++); this.input[0].files = value;
} }
*/
}, },
getInputNode: function() { getInputNode: function() {