1

First this one works:

win.remove(formLogin, true);
win.add(changepswform);
win.doLayout();

Then this one does not wok:

win.add(changepswform);
win.remove(formLogin, true);
win.doLayout();

I get this error:

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

Whose fault is this? Mine? Or ExtJs has a bug?

Note:

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);}}]
            })
        }]
    })
});
ilhan
  • 8,700
  • 35
  • 117
  • 201
  • 1
    Check out [my fiddle](http://jsfiddle.net/tjCmm/1/). Ignore the way I code. Basically I just want to prove that both methods works fine. You may want to share your `doformText` method with us, so we would know which part has coded wrongly. Most probably you run into problem when you are referring to a component that was automatically removed upon window close. – Lionel Chan Jul 21 '11 at 15:23

2 Answers2

1

Using true on .remove method you force garbage collection, thus removing the variable entirely AFAIK.

Edit: FOUND solution, How can I replace the content of a panel with new content? STILL, if you want to re-use (let's say swap multiple times) your panels, you have to use false on .remove()

Community
  • 1
  • 1
Valerio
  • 2,390
  • 3
  • 24
  • 34
1

It looks like you're trying to remove a component in the second block that you've already removed in the first block. Or are you not running the two scripts sequentially?

Miriam
  • 969
  • 1
  • 6
  • 15