Reputation: 5367
I have an Ext 4.2.1 application with an Ext.form.Panel, and when trying to send the form field values to the server, I need to first determine one of the values to do a switch on. Sorry I can't provide a complete example, but the trouble I have is with this command:
form.getForm().findField('TASK_ID')
In my application if throws:
TypeError: Cannot read property 'getItems' of null
at Ext.define.getFields (ext-all-debug.js:89221)
at Ext.define.findField (ext-all-debug.js:89471)
at Ext.Ajax.request.success
Line 89221 is as follows:
getFields: function() {
return this.monitor.getItems();
},
I'm not sure what monitor
is, so I'm a little out of my depth debugging this. Does anyone have any insight as to what might be wrong or what I can check?
Upvotes: 0
Views: 3366
Reputation: 61
When creating form in Ext.window.Window
after window.close()
I got the same error. Debugging my source code, I found out window
handles autoRender
again, it actually conflicts at my singleton window
effect, as follow code:
getUpdateGroupWindow: function(){
var me = this;
if(me.updateGroupWindow == null){
me.updateGroupWindow = Ext.create('MyApp.view.groupEditWindow');
}
return me.updateGroupWindow;
},
read api: http://extjs-doc-cn.github.io/ext4api/#!/api/Ext.window.Window-cfg-closeAction window closeAction
defaults to "destroy", remove the window from the DOM and destroy it and all descendant components. The window will not be available to be re-displayed via the show method, another value 'hide': hide the window by setting visibility to hidden and applying negative offsets. The window will be available to be re-displayed via the show
method.
My final code for example:
Ext.define('MyApp.view.groupEditWindow',{
extend:'Ext.window.Window',
title:'修改信息',
width: 400,
closeAction: 'hide', //fix error config
modal: true,
groupForm:null,
getGroupForm:function(){
var me = this;
if(me.groupForm == null){
me.groupForm = Ext.create('MyApp.view.EditGroupForm');
}
return me.groupForm;
},
initComponent: function(){
var me = this;
Ext.applyIf(me, {
items: [me.getGroupForm()],
buttons: [{
text: '取消',
handler: function() {
me.close();
}
}]
});
me.callParent(arguments);
}
});
Upvotes: 3