PDA

View Full Version : TabPanel content doesn't is incorrectly sized



despay
13 May 2012, 10:25 PM
I have a panel A with a table layout. When I put this inside a normal panel X, the objects are sized correctly, if I put this inside a tabPanel T and put the tabPanel inside the normal panel (X), the content doesn't size correctly.

Panel X > Panel A - looks fine

Panel X > Panel T (tab panel) > Panel A - panel A is cutoff

I have tried adding a wrapper panel with a layout of fit to contain Panel A but this doesn't work. If I set defaults on the tab panel for autoHeight and autoWidth, this partially works except when trying to get the height of Panel T (using getHeight()) it returns the wrong number, a much smaller number than it should be.

Any help would be appreciated.

Cheers

scottmartin
14 May 2012, 6:34 AM
Have you tried using doLayout() to update layout?

Regards,
Scott.

despay
14 May 2012, 1:56 PM
Hi Scott,

Yes, I tried a doLayout() on Panel X which doesn't do anything.

scottmartin
14 May 2012, 2:02 PM
Can you please provide a small working example?

Regards,
Scott.

despay
14 May 2012, 2:17 PM
I am using Ext.ux.JSLoader to get the tabpanel and then onLoad I add it to the formPanel and then call doLayout on the formPanel.

var formPanel = Ext.getCmp('formPanel');
formPanel.removeAll();
formPanel.add(comp);

formPanel.doLayout()

var formHeight = comp.getHeight() + 57;
// mainPanel is the one that holds formPanel. Belom, i'm adjusting the height to a minimum if it is too small. But setting the height of comp doesn't seem to work.
if (formHeight > 656)
{
mainPanel.setHeight(formHeight);
}
else
{
comp.setHeight(656 - 57);
mainPanel.setHeight(656);
}

If I remove autoHeight from defaults of the tabPanel, then when I get the comp height it is incorrect for some reason.

despay
14 May 2012, 9:29 PM
Hi,

I managed to get it working by using the defaults on the tabpanel (comp) of autoHeight: true and then when I set the height of the comp on the load (as mentioned earlier), I set autoHeight = false.

This seems like a hack but I couldn't figure out any other way.