0
我從ExtJs 4.1
轉移到ExtJs 4.2
,因爲filefield
組件的可怕的麻煩。主要的問題是ExtJs 4.1
在每次提交表單後,文件字段被清除。根據這thread,在ExtJs 4.2
他們解決了這個問題,但是,我仍然面臨着我的應用程序中的同樣的問題,儘管事實上我設置了clearOnSubmit
到false
。我甚至想通了什麼樣的代碼導致整個問題:Filefield with clearOnSubmit false仍然被清除
Ext.define('Ext.form.field.FileButton', {
...
createFileInput : function(isTemporary) {
var me = this;
//ATTENTION!
//before me.el.createChild is called
//me.fileInputEl contains initial filefield:
//<input id="filefield-2144-button-fileInputEl" class=" x-form-file-input" type="file" size="1" name="file_name" role="">
me.fileInputEl = me.el.createChild({
name: me.inputName,
id: !isTemporary ? me.id + '-fileInputEl' : undefined,
cls: me.inputCls,
tag: 'input',
type: 'file',
size: 1
});
//ATTENTION!
//now initial fielfield is gone, even though we have set clearOnSubmit to false
me.fileInputEl.on('change', me.fireChange, me);
}
...
這個庫方法被稱爲在某一時刻,當表單提交給服務器和destroyes初始元素:
<input id="filefield-2144-button-fileInputEl" class=" x-form-file-input" type="file" size="1" name="file_name" role="">
,並取代它與一個新的空的:
<input name="file_name" id="ext-gen4414" class="x-form-file-input" type="file" size="1">
那麼,那有什麼問題,我該如何解決這個庫錯誤。
爲此的提琴手。 https://fiddle.sencha.com/#fiddle/1gd2 – UDID