the remove function can take 2 arguments. The 1st is the component to remove, 
the 2nd is the autoDestroy flag. If not specified it defaults to the 
container's autoDestroy value, which defaults to true for Ext.Panel
So when you remove the grids from the grid container you are destroying them 
and they are not available for further use.
You need to either set the 'autoDestroy' config property of the grid container 
panel to false or else specify the 2nd parameter as false in the remove 
function calls.

Matt Priour


From: Robert Buckley 
Sent: Tuesday, April 05, 2011 2:43 AM
To: [email protected] 
Subject: [Users] changing grids in a tabpanel: grids only displayed once


Hi,

I have managed to set up a viewport containing 3 mapPanels which are contained 
in a tab panel.

With the code below I can start the application and the grids are loaded 
according to which tab is activated. The problem is that I can only do it once! 
If I change from from the first tab to the second tab....and then back to the 
first tab, the grid in is not activated!?!?

I´m sure there is a simple explanation...i hope. 
Can anyone see it?

The app is here...
http://maps.zgb.de:8080/geoserver/www/testing/wea_tabs.html


        var centerTabPanel = new Ext.TabPanel({
                    id:'centerTabPanel',
                    region:'center',
                    width: 800, 
                    activeTab: 0,
                    items:[mapPanel_wea, mapPanel_biogas, mapPanel_wasser]
                    });
                    
                    centerTabPanel.items.each(function(tab){
                    
                    tab.on('activate',function(panel){
                            if
                             (panel.id == 'WEA') {
                        //    Ext.Msg.alert('Panel', panel.id + '" tab?');
                            gridContainer.remove(grid_wasser);
                            gridContainer.remove(grid_biogas);
                            gridContainer.add(grid_wea);
                            gridContainer.doLayout();
                            }
                            else
                            if (panel.id == 'Biogas') {
                        //    Ext.Msg.alert('Panel', panel.id + '" tab?');
                            gridContainer.remove(grid_wea);
                            gridContainer.remove(grid_wasser);
                            gridContainer.add(grid_biogas);
                            gridContainer.doLayout();
                            }
                            else
                            if (panel.id == 'Wasserkraft') {
                        //    Ext.Msg.alert('Panel', panel.id + '" tab?');
                            gridContainer.remove(grid_wea);
                            gridContainer.remove(grid_biogas);
                            gridContainer.add(grid_wasser);
                            gridContainer.doLayout();
                            }
                    });
        
                }); 


Thanks for any help,

Robert



--------------------------------------------------------------------------------


_______________________________________________
Users mailing list
[email protected]
http://www.geoext.org/cgi-bin/mailman/listinfo/users
_______________________________________________
Users mailing list
[email protected]
http://www.geoext.org/cgi-bin/mailman/listinfo/users

Reply via email to