Results 1 to 2 of 2

Thread: How to remove and readd a FormPanel into a Window

  1. #1
    Sencha User
    Join Date
    May 2011
    Location
    Karachi
    Posts
    9

    Default How to remove and readd a FormPanel into a Window

    I'm having a problem where I would like to remove a FormPanel from a Window.


    Here is my Form which is being loaded in a Window:


    Code:
    myForm = new Ext.FormPanel({
            frame: true,
            width: '100%',
            id: 'myform',
            layout: 'form',
            autoHeight: true,
            autoDestroy: false,
            region: 'center',
            monitorValid: true,
            items: [{
                xtype: 'textfield',
                id: 'mytextfield',
                fieldLabel: 'My Label',
                
            }]
         });
          
        MyWindow =  new Ext.Window({
          title: 'MyWindow',  
        	layout: 'auto',
        	resizable: false,
          width: 717, 
        	autoheight:true,
          id:'mywindow',
        	closeAction:'hide',
          closable: true,
        	items:[Ext.getCmp("myform")]
          
         
          });
    Now I want to remove this form and have to show another form, and I'm doing like this somewhere else:


    Code:
      MyWindow.removeAll();
        MyWindow.add(Ext.getCmp("myAnotherForm"));
    But this gives me error `"Uncaught TypeError: Cannot read property 'events' of undefined"` in ext-all-debug.js.


    Is there anything, I'm missing here ?


    Thanks.

  2. #2
    Sencha User
    Join Date
    May 2011
    Location
    Karachi
    Posts
    9

    Lightbulb

    I have worked around this problem by using the "destroy()" mehtod of the form and then add the same form in the window.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •