ExtJS和Internet Explorer:滚动条出现时布局损坏

5
我在使用Internet Explorer时遇到了一些问题。我有一个包含几个ExtJS元素的窗口,其中一个Fieldset包含一个组件。
窗口是可调整大小的,当用户将窗口调整为小于显示其内容所需的大小时,我希望滚动条出现。
这在FireFox 3.6.x中运行良好,但在使用IE7或IE8时,会出现以下结果:
为什么我在Internet Explorer中得到这个结果?我想做的事情难道不可能吗?
生成上述结果的代码如下:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <title>Online example</title>
    <link rel="stylesheet" type="text/css" href="http://dev.sencha.com/deploy/dev/resources/css/ext-all.css" />

    <script type="text/javascript" src="http://dev.sencha.com/deploy/dev/adapter/ext/ext-base.js"></script>     

    <script type="text/javascript" src="http://dev.sencha.com/deploy/dev/ext-all.js"></script>    

</head>
<body>

<script type="text/javascript">

Ext.onReady(function(){

    MyWindow = Ext.extend(Ext.Window, {         
        resizable: true,
        closable: true,
        width: 400,
        closeAction: 'hide',                        
        title: 'Window',
        autoScroll: true,
        layout: 'fit',

        initComponent: function () {

            var config = {
                items:
                [
                    {
                        xtype: 'fieldset',
                        title: 'Fieldset',
                        layout: 'form',
                        items:
                        [
                            {
                                xtype: 'numberfield',                                                                                                       
                                fieldLabel: 'Label'                                    
                            }, {
                                xtype: 'checkbox',
                                fieldLabel: 'Label',
                                checked: true                                    
                            }, {
                                xtype: 'checkbox',
                                fieldLabel: 'Label',
                                checked: true                                    
                            }, {
                                xtype: 'checkbox',
                                fieldLabel: 'Label',
                                checked: true                                    
                            }
                        ]
                    }
                ]
            }

            Ext.apply(this, config);

            // Config object has already been applied to 'this' so properties can 
            // be overriden here or new properties (e.g. items, tools, buttons) 
            // can be added, eg:

            // Call parent (required)
            MyWindow.superclass.initComponent.apply(this, arguments);
        }   
    });

    AWindow = new MyWindow();
    AWindow.show();
});

</script>

</body>
</html>

我知道这个问题与我之前的一个问题非常相似,但我希望这次我更清楚地表达我的要求。- 这与IE7和IE8都有关。

2个回答

1

我发现当给窗口时:

bodyStyle: 'position:relative;'

FieldSet 保持在窗口内。为什么需要这样做我不知道,也不知道如何以更Extjs'y的方式设置此属性。

如果您有任何评论,我欢迎它们,希望能得到启示 :)


1

我通过将fieldset包装在面板中,并将autoscroll从窗口移动到面板中,使得这个例子可以运行:

MyWindow = Ext.extend(Ext.Window, {         
        resizable: true,
        closable: true,
        width: 400,
        height: 200,
        closeAction: 'hide',                        
        title: 'Window',
        layout: 'fit',

        initComponent: function () {

            var config = {
                items: {
                    xtype: 'panel',
                    autoScroll: true,
                    items: [
                        {
                            xtype: 'fieldset',
                            title: 'Fieldset',
                            layout: 'form',
                            items:
                            [
                                {
                                    xtype: 'numberfield',                                                                                                       
                                    fieldLabel: 'Label'                                    
                                }, {
                                    xtype: 'checkbox',
                                    fieldLabel: 'Label',
                                    checked: true                                    
                                }, {
                                    xtype: 'checkbox',
                                    fieldLabel: 'Label',
                                    checked: true                                    
                                }, {
                                    xtype: 'checkbox',
                                    fieldLabel: 'Label',
                                    checked: true                                    
                                }
                            ]
                        }
                    ]
                }
            }

            Ext.apply(this, config);

            // Config object has already been applied to 'this' so properties can 
            // be overriden here or new properties (e.g. items, tools, buttons) 
            // can be added, eg:

            // Call parent (required)
            MyWindow.superclass.initComponent.apply(this, arguments);
        }   
    });

    AWindow = new MyWindow();
    AWindow.show();
});

一些注意事项:

  • 我必须给窗口一些高度,才能在打开时显示任何内容。
  • 您的原始示例在“怪异模式”下运行良好,您可以通过删除文件顶部的DOCTYPE声明来获得该模式。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接