PDA

View Full Version : TabPanel or ContentPanel?



Ronaldo
7 Sep 2007, 6:07 AM
Hi all,

This is kinda related to http://extjs.com/forum/showthread.php?t=12528, but I didn't want to spoil that thread.

Basically, I have a standard form with some fields, and below that, several tabs with on each tab a grid containing child records.
Now I'm creating a tabPanel and using its addTab method I add tabs. But there also is a ContentPanel which can also display tabs.
Is there a difference? Is there a preferred choice?

I have a problem resizing the grid to fit the tabPanelItem, and I was wondering if this would work better with a Layout, a single region and multiple ContentPanels.

TIA
Ronaldo

Animal
7 Sep 2007, 6:09 AM
Layout + Region + ContentPanels/(GridPanels containing Grids)

Ronaldo
7 Sep 2007, 6:18 AM
Thanks for your quick reply.

Ronaldo
7 Sep 2007, 6:46 AM
Hmmm. Quick but fundamental follow-up question...Maybe I'm dumb but I don't get it (And I really want to ;)

Taken from the example layout (simple).... How does Ext know that the 'west' region should have a vertical split, and the south region a horizontal split?
Is it in the order in which the div's are placed? I changed that and it remains the same...
Is it in the order in which the region's are defined? I changed that too and it remains the same...


var layout = new Ext.BorderLayout(document.body, {
north: {
split:false,
initialSize: 35
},
south: {
split:false,
initialSize: 20
},
west: {
split:false,
initialSize: 200,
collapsible: false
},
center: {
autoScroll: true
}
});
layout.beginUpdate();
layout.add('north', new Ext.ContentPanel('header', {fitToFrame:true}));
layout.add('south', new Ext.ContentPanel('footer', {fitToFrame:true}));
layout.add('west', new Ext.ContentPanel('nav', {fitToFrame:true}));
layout.add('center', new Ext.ContentPanel('content'));
layout.endUpdate();


I guess it's obvious for everybody, but not for me now...:-?

Animal
7 Sep 2007, 7:00 AM
North's border with Center is horizontal.

West's border with Center is vertical.

etc.

Ronaldo
7 Sep 2007, 11:40 AM
Ah, how silly of me. It's in the names of the regions... 'north' means split top, 'east' means split left.

I was experimenting with region names like 'left', 'top' etc, and was looking for another property which would define the horizontal or vertical split of the space left.