Extjs重置文件字段输入

ved*_*med 5 javascript extjs file-upload

如何在ExtJS中重置文件字段输入?我在尝试:

//this - point on Ext.panel.Form

var form = this.getForm();
form.reset();

var filefield = this.getForm().getFields().get(0);
filefield.reset();

filefield.setValue('');

filefield.value = '';
Run Code Online (Sandbox Code Playgroud)

但这些方法中没有一种不起作用.谢谢你的帮助!

小智 5

使用以下代码将帮助您

function clearFileUpload(id){
    // get the file upload element
    fileField     = document.getElementById(id);
    // get the file upload parent element
    parentNod     = fileField.parentNode;
    // create new element
    tmpForm        = document.createElement("form");
    parentNod.replaceChild(tmpForm,fileField);
    tmpForm.appendChild(fileField);
    tmpForm.reset();
    parentNod.replaceChild(fileField,tmpForm);
}
Run Code Online (Sandbox Code Playgroud)