views:

2313

answers:

2

I've just run into a display glitch in IE6 with the ExtJS framework. - Hopefully someone can point me in the right direction.

In the following example, the bbar for the panel is displayed 2ems narrower than the panel it is attached to (it's left aligned) in IE6, where as in Firefox it is displayed as the same width as the panel.

Can anyone suggest how to fix this?

I seem to be able to work around either by specifying the width of the panel in ems or the padding in pixels, but I assume it would be expected to work as I have it below.

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt;
<html>
<head>
    <link rel="stylesheet" type="text/css" href="ext/resources/css/ext-all.css"/>
    <script type="text/javascript" src="ext/ext-base.js"></script>
    <script type="text/javascript" src="ext/ext-all-debug.js"></script>
    <script type="text/javascript">

    Ext.onReady(function(){        
        var main = new Ext.Panel({
            renderTo: 'content',
            bodyStyle: 'padding: 1em;',
            width: 500,
            html: "Alignment issue in IE - The bbar's width is 2ems less than the main panel in IE6.",
            bbar: [
                    "->",
                {id: "continue", text: 'Continue'}
            ]
        });
    });

    </script>
</head>
<body>
    <div id="content"></div>
</body>
</html>
+1  A: 

Maybe you should try to force the width of the bbar:

main.getBottomToolbar().setWidth(500);

right after Panel creation?

But I think the problem is that bbar is rendered into inner div of the panel, so different browsers interpret outer padding differently.

Also you can try to set padding of the bbar to -1em.

Thevs
+1  A: 

The problem comes from the custom bodyStyle padding. It makes the panel content larger, but not the toolbar.

One possible solution is to further nest an Ext panel, like:

    var main = new Ext.Panel({
        renderTo: 'content',
        width: 500,
        items: {
            bodyStyle: 'padding: 1em;',
            border: false,
            html: "Now alignment is fine."
        },
        bbar: [
                "->",
            {id: "continue", text: 'Continue'}
        ]
    });

The border: false is needed to avoid double bordering.

tsg