PDA

View Full Version : bodyStyle problem



fermo111
9 Jun 2009, 4:21 AM
I have installed ExtJS 3.0 RC2 and tested my application. It seems that in all the panels that are defined with a

bodyStyle: 'padding:1em'
the padding is ignored.
If instead of using 'em' I use 'px', then it works. E.g.:

bodyStyle: 'padding:10px'

Is there a problem with ems?

Thanks

Animal
9 Jun 2009, 4:51 AM
Did you look at the DOM with Firebug and see if the style was actually there in the document?

Animal
9 Jun 2009, 4:55 AM
I see it using the style.

But adding padding to a Panel's body causes problems with laying out the Panel's structure.

What are you trying to acheive?

fermo111
9 Jun 2009, 5:38 AM
Thanks Animal,

I simply want some space between the border and the contents of the panel.

Yes, I can see the padding in Firebug. This is what Firebug reports if I use '1em':


element.style {
height:558px;
overflow-x:auto;
overflow-y:auto;
padding-bottom:1em;
padding-left:1em;
padding-right:1em;
padding-top:1em;
width:1738px;
}


and this is the same panel using '10px':


element.style {
height:540px;
overflow-x:auto;
overflow-y:auto;
padding-bottom:10px;
padding-left:10px;
padding-right:10px;
padding-top:10px;
width:1720px;
}

In this case the panel has a 'fit' layout and contains a grid.
In the '1em' case, the grid has a 1em margin at its top and left, but its right and bottom borders extend beyond the container's border. Infact, if from Firebug, I set the padding to 0, the grid is shown completely.

Thanks

Animal
9 Jun 2009, 5:52 AM
The problem is because the actual amount of space required to size the Panel correctly cannot be measured by Javascript if you use other units than "px"

fermo111
9 Jun 2009, 10:44 PM
Thanks Animal.

Just a curiosity. Since this used to work in 2.2, is this new to 3.0? When porting to 3.0, should I change all the measure units from em to px?

Thanks

Luca

Animal
9 Jun 2009, 11:27 PM
I'm not sure why it changed. That layout calculation code is complicated.