我正在使用 ExtJS 弹出一个带有简单编辑表单的窗口,但是在按下提交按钮时,没有进行 XHR 调用,并且我this.form.el.dom is undefined
在控制台中报告了一个错误。
这是我的代码:
var myNameSpace = new function(){
var editForm, editWindow;
this.init = function(){
Ext.Ajax.request({
url: '/server/action.php',
success: function(result){
console.log('ajax is working ok'); // I get this
}
});
editForm = new Ext.form.FormPanel({
width:450,
autoHeight: true,
header : false,
items: [{
name: 'color',
fieldLabel: 'Color',
xtype: 'textfield',
value: 'blue'
}],
buttons: [{
text:"Submit",
scope: this, // tried without this, too
handler: function(){
// editForm.getForm().getValues() returns normal values
editForm.getForm().submit({
url: '/server/action.php',
success: function(form, action) {
console.log('Yes! Success!'); // I don't get this
},
failure: function(form, action) {
console.log('failed.'); // I don't get this
}
});
editWindow.close(); // works
console.log('the form is now closed'); // I get this
}
}]
});
editWindow = new Ext.Window(
{
title:'Enter your color',
autoWidth: true,
autoHeight: true,
layout: 'fit',
modal: true,
items: editForm,
closeAction: 'hide'
});
editWindow.show();
};
};
Ext.onReady(function () {
myNameSpace.init();
});
任何关于这个主题的观点都将受到极大的赞赏和热烈的支持。