Javascript Ext JS无法读取属性';getItems';空的

Javascript Ext JS无法读取属性';getItems';空的,javascript,extjs,Javascript,Extjs,我有一个带有Ext.form.Panel的Ext 4.2.1应用程序,当尝试将表单字段值发送到服务器时,我需要首先确定其中一个值以进行切换。很抱歉,我无法提供完整的示例,但我遇到的问题是此命令: form.getForm().findField('TASK_ID') 在我的应用程序中,如果抛出: TypeError: Cannot read property 'getItems' of null at Ext.define.getFields (ext-all-debug.js:892

我有一个带有Ext.form.Panel的Ext 4.2.1应用程序,当尝试将表单字段值发送到服务器时,我需要首先确定其中一个值以进行切换。很抱歉,我无法提供完整的示例,但我遇到的问题是此命令:

form.getForm().findField('TASK_ID')
在我的应用程序中,如果抛出:

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
第89221行如下:

getFields: function() {
    return this.monitor.getItems();
},

我不确定什么是
monitor
,所以我调试这个有点不深入。是否有人知道哪些地方可能出错,或者我可以检查哪些地方?

Ext.window.window
中创建表单时,在
window.close()之后我遇到了相同的错误。调试我的源代码时,我再次发现
window
句柄
autoRender
,它实际上与我的singleton
window
效果冲突,如下代码:

getUpdateGroupWindow: function(){
        var me = this;
        if(me.updateGroupWindow == null){
            me.updateGroupWindow = Ext.create('MyApp.view.groupEditWindow');
        }
        return me.updateGroupWindow;
    },
阅读api:window
closeAction
默认为“销毁”,从DOM中删除窗口并销毁它和所有子体组件。窗口将无法通过显示方法重新显示,另一个值为“隐藏”:通过将可见性设置为“隐藏”并应用负偏移来隐藏窗口。该窗口可通过
show
方法重新显示

例如,我的最终代码:

 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);
    }
});

Ext.window.window
after
window.close()
中创建表单时,我遇到了相同的错误。调试我的源代码时,我再次发现
window
句柄
autoRender
,它实际上与我的singleton
window
效果冲突,如下代码:

getUpdateGroupWindow: function(){
        var me = this;
        if(me.updateGroupWindow == null){
            me.updateGroupWindow = Ext.create('MyApp.view.groupEditWindow');
        }
        return me.updateGroupWindow;
    },
阅读api:window
closeAction
默认为“销毁”,从DOM中删除窗口并销毁它和所有子体组件。窗口将无法通过显示方法重新显示,另一个值为“隐藏”:通过将可见性设置为“隐藏”并应用负偏移来隐藏窗口。该窗口可通过
show
方法重新显示

例如,我的最终代码:

 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);
    }
});

Ext.window.window
after
window.close()
中创建表单时,我遇到了相同的错误。调试我的源代码时,我再次发现
window
句柄
autoRender
,它实际上与我的singleton
window
效果冲突,如下代码:

getUpdateGroupWindow: function(){
        var me = this;
        if(me.updateGroupWindow == null){
            me.updateGroupWindow = Ext.create('MyApp.view.groupEditWindow');
        }
        return me.updateGroupWindow;
    },
阅读api:window
closeAction
默认为“销毁”,从DOM中删除窗口并销毁它和所有子体组件。窗口将无法通过显示方法重新显示,另一个值为“隐藏”:通过将可见性设置为“隐藏”并应用负偏移来隐藏窗口。该窗口可通过
show
方法重新显示

例如,我的最终代码:

 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);
    }
});

Ext.window.window
after
window.close()
中创建表单时,我遇到了相同的错误。调试我的源代码时,我再次发现
window
句柄
autoRender
,它实际上与我的singleton
window
效果冲突,如下代码:

getUpdateGroupWindow: function(){
        var me = this;
        if(me.updateGroupWindow == null){
            me.updateGroupWindow = Ext.create('MyApp.view.groupEditWindow');
        }
        return me.updateGroupWindow;
    },
阅读api:window
closeAction
默认为“销毁”,从DOM中删除窗口并销毁它和所有子体组件。窗口将无法通过显示方法重新显示,另一个值为“隐藏”:通过将可见性设置为“隐藏”并应用负偏移来隐藏窗口。该窗口可通过
show
方法重新显示

例如,我的最终代码:

 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);
    }
});

是否呈现表单?
当对
Ext.form.Basic
对象调用
destroy
时,此.monitor
设置为null。在表单的生命周期中,您何时调用
findField
方法?感谢您的评论;这有助于我找到问题(竞争条件)表单是否呈现?
this.monitor
Ext.form.Basic
对象上调用
destroy
时设置为null。在表单的生命周期中,您何时调用
findField
方法?感谢您的评论;这有助于我找到问题(竞争条件)表单是否呈现?
this.monitor
Ext.form.Basic
对象上调用
destroy
时设置为null。在表单的生命周期中,您何时调用
findField
方法?感谢您的评论;这有助于我找到问题(竞争条件)表单是否呈现?
this.monitor
Ext.form.Basic
对象上调用
destroy
时设置为null。在表单的生命周期中,您何时调用
findField
方法?感谢您的评论;这有助于我发现问题(比赛条件)