doLAyout在ExtJs中无法工作两次

doLAyout在ExtJs中无法工作两次,layout,extjs,Layout,Extjs,首先,这一个有效: win.remove(formLogin, true); win.add(changepswform); win.doLayout(); 那么这个就不行了: win.add(changepswform); win.remove(formLogin, true); win.doLayout(); 我得到这个错误: uncaught exception: [Exception... "Component returned failure code: 0x80004003 (N

首先,这一个有效:

win.remove(formLogin, true);
win.add(changepswform);
win.doLayout();
那么这个就不行了:

win.add(changepswform);
win.remove(formLogin, true);
win.doLayout();
我得到这个错误:

uncaught exception: [Exception... "Component returned failure code: 0x80004003 (NS_ERROR_INVALID_POINTER) [nsIDOMHTMLDivElement.insertBefore]" nsresult: "0x80004003 (NS_ERROR_INVALID_POINTER)" location: "JS frame :: http://app.localhost.com/ext-4.0.2/ext-all.js :: <TOP_LEVEL> :: line 15" data: no]
[Break On This Error] (function(){var e=this,a=Object.protot...ate("Ext.XTemplate",j,g)}return j}}); 

看起来您正试图删除在第一个块中已删除的第二个块中的组件。或者您没有按顺序运行这两个脚本?

使用启用的true删除方法强制垃圾收集,从而完全删除变量

编辑:找到解决方案, 仍然,如果要重复使用(比如多次交换)面板,则必须在.remove()上使用false。忽略我编写代码的方式。基本上我只是想证明这两种方法都很有效。您可能希望与我们共享您的
doformText
方法,以便我们知道哪个部分编码错误。当您引用一个在窗口关闭时自动删除的组件时,很可能会遇到问题。
var win = Ext.create('Ext.Window', {
    title: 'Asistan Web: Online Teknik Servis Yazılımı',
    width: 350,
    minWidth: 350,
    height: 240,
        closable: false,
    modal: true,
    bodyStyle: 'padding:10px;',
        items: [formLogin],
    bbar: Ext.create('Ext.ux.StatusBar', {
        id: 'win-statusbar',
        defaultText: 'Giriş',
        items: [ 
        {
            xtype:'splitbutton',
            text:'Şifre işlemleri',
            menuAlign: 'br-tr?',
            menu: Ext.create('Ext.menu.Menu', {
                items: [{text: LANG.LOGIN_FORGOT_PASS,              handler : 
                    function(){
                        if(confirm(LANG.LOGIN_MAIL_CONFIRM))doformTest(1);
                        Ext.getCmp('win-statusbar').setText('');
                    }}, {text: LANG.LOGIN_CHANGE_PASS, handler : function(){doformTest(2);}}]
            })
        }]
    })
});