View Full Version : TabPanel layout:'fit' causes "this.layout.setContainer is not a function"

2 Sep 2010, 1:14 PM
I do not understand if this is a bug, or expected behavior.

My reading of the docs suggests that layout: 'fit' is valid for a TabPanel. But the code below causes an exception, regardless if I set layout to 'fit' or 'anchor'.

var viewport = new Ext.Viewport( {
items: [ {
xtype: 'tabpanel',

// Uncomment the next line to get JS exception:
// "this.layout.setContainer is not a function"
//layout: 'fit',
// Same error happens with 'anchor':
//layout: 'anchor',

items: [ {
title: 'Tab1',
html: "This is the first tab."
} ]
} ]
} );
Could somebody please explain to this n00b why this error happens? I'm looking for a deeper understanding of how the layout relates to the component.

I want my TabPanel to grow itself into all of the Container's space. If setting layout: 'fit' is not the right way to do that, then what is the correct way? Embed every TabPanel into a Panel?

2 Sep 2010, 1:19 PM
TabPanel uses card layout. You can't change that.

3 Sep 2010, 1:30 AM
The TabPanel is already behaving correctly, but you want to set the Viewport to layout:'fit'.