Mark Wells
4 Oct 2007, 11:01 AM
I'm my app I have 3 regions, north being the toolbar, south being used for alerts and tips and center for the "dialogs"... ahhh the center panel it getting me sick :D
In the initialization of the app the center region is barely empty, just to have a background image defined in css, that's done and perfectly working. (=D> I deserve :)):)))
Let me starting showing how I'm dealing with BorderLayout, just for the sake of knowledge any item of the menu in the toolbar will add a new tab on the center region.
The MainLayout is defined as above. It is in the INIT Section
mainLayout = new Ext.BorderLayout('container',{
north:{initialSize:49, split:false, titlebar:true, title:'<b>.:: Sistema WebSiaux ::.</b>', margins:{top:0,bottom:2,right:0,left:0}},
south:{animate:true, autoScroll:true, collapsible:true, initialSize:80, split:false, title:'<b>.:: Dicas de Uso ::.</b>', titlebar:true},
center:{autoScroll:true, titlebar:true}
});
mainLayout.beginUpdate();
mainLayout.add('north', new Ext.ContentPanel('toolbar',{toolbar:appToolbar}));
mainLayout.add('south', new Ext.ContentPanel('statusBar',{autoScroll:true, closable:false, fitToFrame:true}));
mainLayout.add('center', new Ext.ContentPanel('content',{autoScroll:true, closable:true, fitToFrame:true}));
mainLayout.endUpdate();
Let's suppose that I click the item menu as explained above. Pretty simple.
new Ext.menu.Item({
text:'<b>Veículo Oficial</b>',
id:'tb_cmdTabVeiOfi',
icon:'images/list-items.gif',
handler: this.showTabVeiOfi
})
I'm expecting a new Tab called Veiculos Oficiais and inside this tab I'm expecting a grid that shows some data that comes from a database. BUT (OMG we always have a BUT in this cases... /:)) when I close this tab and try to reopen it I get an error as showed in the picture of firebug below.
showTabVeiOfi: function(){
...
...
var ds ...;
var cm ...;
var grid = new Ext.grid.Grid('veiOfiGridEditor', {...});//veiOfiGridEditor is the target div where the grid will be rendered althought I'm not using a GridEditor
//ADDING THE PANEL IN THE CENTER REGION
mainLayout.beginUpdate();
mainLayout.add('center', new Ext.ContentPanel('veiOfiCad',{title:'<b>Veículo Oficial</b>', autoScroll:true, closable:true, fitToFrame:true}));
mainLayout.endUpdate();
//ADDING THE "NESTED" PANEL WITHIN THE CENTER REGION
var innerLayout = Ext.BorderLayout.create({
center: {
margins:{left:3,top:3,right:3,bottom:3},
panels: [new Ext.GridPanel(veiOfiGrid)]
}
}, 'veiOfiGrid');
grid.render();
//more configurations for the grid
...
...
};
FIREBUG IMAGE 1:
http://img206.imageshack.us/img206/6491/fb1zq3.jpg
FIREBUG IMAGE 2:
http://img205.imageshack.us/img205/2446/fb2ji3.jpg
And finally the HTML of this page
<body>
<div id="container">
<div id="toolbar" class="x-layout-inactive-content"></div>
<div id="content" class="x-layout-inactive-content">
<div id="veiOfiCad" class="x-layout-inactive-content">
<div id="veiOfiGrid"></div>
<div id="veiOfiGridEditor"></div>
</div>
</div>
<div id="statusBar" class="x-layout-inactive-content"></div>
</div>
</body>
I hope someone can help me.
Thanks in advance
Mark Wells
In the initialization of the app the center region is barely empty, just to have a background image defined in css, that's done and perfectly working. (=D> I deserve :)):)))
Let me starting showing how I'm dealing with BorderLayout, just for the sake of knowledge any item of the menu in the toolbar will add a new tab on the center region.
The MainLayout is defined as above. It is in the INIT Section
mainLayout = new Ext.BorderLayout('container',{
north:{initialSize:49, split:false, titlebar:true, title:'<b>.:: Sistema WebSiaux ::.</b>', margins:{top:0,bottom:2,right:0,left:0}},
south:{animate:true, autoScroll:true, collapsible:true, initialSize:80, split:false, title:'<b>.:: Dicas de Uso ::.</b>', titlebar:true},
center:{autoScroll:true, titlebar:true}
});
mainLayout.beginUpdate();
mainLayout.add('north', new Ext.ContentPanel('toolbar',{toolbar:appToolbar}));
mainLayout.add('south', new Ext.ContentPanel('statusBar',{autoScroll:true, closable:false, fitToFrame:true}));
mainLayout.add('center', new Ext.ContentPanel('content',{autoScroll:true, closable:true, fitToFrame:true}));
mainLayout.endUpdate();
Let's suppose that I click the item menu as explained above. Pretty simple.
new Ext.menu.Item({
text:'<b>Veículo Oficial</b>',
id:'tb_cmdTabVeiOfi',
icon:'images/list-items.gif',
handler: this.showTabVeiOfi
})
I'm expecting a new Tab called Veiculos Oficiais and inside this tab I'm expecting a grid that shows some data that comes from a database. BUT (OMG we always have a BUT in this cases... /:)) when I close this tab and try to reopen it I get an error as showed in the picture of firebug below.
showTabVeiOfi: function(){
...
...
var ds ...;
var cm ...;
var grid = new Ext.grid.Grid('veiOfiGridEditor', {...});//veiOfiGridEditor is the target div where the grid will be rendered althought I'm not using a GridEditor
//ADDING THE PANEL IN THE CENTER REGION
mainLayout.beginUpdate();
mainLayout.add('center', new Ext.ContentPanel('veiOfiCad',{title:'<b>Veículo Oficial</b>', autoScroll:true, closable:true, fitToFrame:true}));
mainLayout.endUpdate();
//ADDING THE "NESTED" PANEL WITHIN THE CENTER REGION
var innerLayout = Ext.BorderLayout.create({
center: {
margins:{left:3,top:3,right:3,bottom:3},
panels: [new Ext.GridPanel(veiOfiGrid)]
}
}, 'veiOfiGrid');
grid.render();
//more configurations for the grid
...
...
};
FIREBUG IMAGE 1:
http://img206.imageshack.us/img206/6491/fb1zq3.jpg
FIREBUG IMAGE 2:
http://img205.imageshack.us/img205/2446/fb2ji3.jpg
And finally the HTML of this page
<body>
<div id="container">
<div id="toolbar" class="x-layout-inactive-content"></div>
<div id="content" class="x-layout-inactive-content">
<div id="veiOfiCad" class="x-layout-inactive-content">
<div id="veiOfiGrid"></div>
<div id="veiOfiGridEditor"></div>
</div>
</div>
<div id="statusBar" class="x-layout-inactive-content"></div>
</div>
</body>
I hope someone can help me.
Thanks in advance
Mark Wells