简体   繁体   中英

Showing same panel in a window and tabpanel ExtJs

I have a panel inside a tabpanel and when a button is pressed i want to show that panel inside a full screen window. here is what i am doing now:

 var panel = Ext.ComponentQuery.query('apanel')[0];
     if(button.pressed){
          if(Ext.getCmp('awindow')){ //if the window already exists
                Ext.getCmp('awindow').items.add(panel).show();// add the item to it
          } else{ // create a new window with the element
            Ext.create('Ext.window.Window', {
                title: 'Model Selector',
                layout: 'fit',
                id: 'apanel',
                contentEl: panel.getId(),
                maximized: true
            }).show();
        }
    }  else {
        Ext.getCmp('apanel').close(); // close the window
        Ext.ComponentQuery.query('maintabpanel')[0].updateLayout(); // update layout
    }

But it is giving me this error :

Failed to execute 'insertBefore' on 'Node': parameter 1 is not of type 'Node'.

what should i do so that the same panel is shown in tab panel when i close the window?

The .close() method on window was causing the problem so i use the .hide() on window instead.

if(button.pressed){
          if(Ext.getCmp('awindow')){ //if the window already exists
                Ext.getCmp('awindow').items.add(panel).show();// add the item to it
                Ext.getCmp('awindow').show()
          } else{ // create a new window with the element
            Ext.create('Ext.window.Window', {
                title: 'Model Selector',
                layout: 'fit',
                id: 'apanel',
                contentEl: panel.getId(),
                maximized: true
            }).show();
        }
    }  else {
        Ext.getCmp('apanel').hide(); // close the window
        Ext.ComponentQuery.query('maintabpanel')[0].updateLayout(); // update layout
    }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM