PDA

View Full Version : new Ext.TabPanel(...) into ContentPanel?



Carel
21 May 2007, 12:23 AM
Given some BorderLayout with some ContentPanels, now I would like to add a tab panel with tabs to one of those ContentPanels using new Ext.TabPanel(...) as shown in the tab examples. Is that possible? What is the correct way of achieving such a combination?

Thank you

si-rus
21 May 2007, 12:54 AM
Look at this
http://extjs.com/forum/showthread.php?t=6260
http://extjs.com/forum/showthread.php?t=6229
;)

Carel
21 May 2007, 1:48 AM
Thank you a lot, I played a little with the example you gave and now I have a tab panel inside a content panel, the script I had to place directly before </body> to avoid its output being overriden with the output of the BorderLayout that gets done onDocumentReady.

Having

var tabs = new Ext.TabPanel('tabs');
var t = tabs.addTab('id1', 'Title1', 'Content Tab1' );
var t2 = tabs.addTab('id2', 'Title2');
var tabs2 = new Ext.TabPanel(t2.bodyEl);
var t2 = tabs2.addTab('id3', 'Title3', 'Content Tab3');

inside the layout script also gives a tabpanel but the only relation to the BorderLayout/ContentPanel then is by the hard <div> element with id 'tabs'.

Could the tabpanel be made into a child of a contentpanel by adding it as a child to the contentpanel? E.g. like so (but this does not work and given the div 'tabs' would be a possible source of conflict):

layout.add('center', new Ext.ContentPanel(tabs));

Still, it would be nice if the tabpanel were created stand-alone (without specifying the div) and later on added to the contentpanel which would create a div and position it. Is such a thought any good? Would it be possible?