Also accept file names to remove.

This commit is contained in:
Nathan Gray 2014-09-18 18:56:43 +00:00
parent 9743c19318
commit 378a11f841

View File

@ -558,10 +558,16 @@ var et2_file = et2_inputWidget.extend(
/** /**
* Remove a file from the list of values * Remove a file from the list of values
*
* @param {File|string} File object, or file name, to remove
*/ */
remove_file: function(file) remove_file: function(file)
{ {
//console.info(filename); //console.info(filename);
if(typeof file == 'string')
{
file = {fileName: file};
}
for(var key in this.options.value) for(var key in this.options.value)
{ {
if(this.options.value[key].name == file.fileName) if(this.options.value[key].name == file.fileName)
@ -571,7 +577,7 @@ var et2_file = et2_inputWidget.extend(
return; return;
} }
} }
if(!file.isComplete()) file.cancel(); if(file.isComplete && !file.isComplete() && file.cancel) file.cancel();
}, },
/** /**