Extjs 窗口在 IE 中不能很好地显示元素

Extjs window doesnt show elements well in IE

本文关键字:很好 显示 元素 不能 窗口 IE Extjs      更新时间:2023-09-26

我有这个代码

 var main_container = Ext.create('Ext.container.Container',
 {
     xtype: 'container',
     id: "id_container",
     anchor: '100%',
     layout:'column',
     items:[
        column_1,
        column_2,
        column_3
     ]
})

当我调整容器的大小时,最右边的列在某些情况下会消失。在某些情况下,当我再次调整大小时,最右边的列再次出现。这只发生在IE中。

可能是什么原因造成的?任何想法都会有所帮助。

这是最右边列的结构

  var column_3 = Ext.create('Ext.container.Container',
  {
    columnWidth: .33,
    layout: 'anchor',
    id: 'column_3',
    items:[
        grid_1,
        grid_2
    ]
  })

有 3 列,我希望它们的宽度为 33%

主容器在按下 ext js 菜单按钮时被关闭。主容器放置在 ext js 窗口中。

这是我的问题

 <div class="x-container x-column x-container-default" id="column_roles" role="presentation" style="width: 400px;">
       <DIV style="WIDTH: 413px; HEIGHT: 45%" id=grid_1 class="x-panel  x-grid x-property-grid x-panel-default x-with-col-lines x-panel-with-col-lines x-panel-default-with-col-lines x-masked-relative x-masked" role=presentation aria-labelledby=component-1234>...</div>
        <DIV style="WIDTH: 413px; HEIGHT: 45%" id=grid_2 class="x-panel  x-grid x-property-grid x-panel-default x-with-col-lines x-panel-with-col-lines x-panel-default-with-col-lines x-masked-relative x-masked" role=presentation aria-labelledby=component-1237> ... </div>
 </div>

您可以清楚地看到内部div 比包含它们的div 宽。为什么IE生成不好?这在Chrome和FF中不会发生。

如果这只发生在IE中,你有没有考虑过放弃IE作为浏览器?撇开笑话不谈,如果它可以在IE以外的任何浏览器中工作,则可能是一个错误,或者您必须仅对IE做一些特殊的事情。

例如,这对我有用:

Ext.onReady (function () {
    Ext.create ('Ext.window.Window', {
        renderTo: Ext.getBody () ,
        title: 'Win' ,
        width: 500 ,
        height: 100 ,
        layout: 'anchor' ,
        resizable: true ,
        items: [{
            xtype: 'container' ,
            anchor: '100%' ,
            layout: 'column' ,
            defaults: {
                layout: 'anchor'
            } ,
            items: [{
                xtype: 'container' ,
                columnWidth: .33 ,
                defaults: {
                    xtype: 'textfield' ,
                    anchor: '100%'
                } ,
                items: [{
                    fieldLabel: 'name'
                } , {
                    fieldLabel: 'surname'
                }]
            } , {
                xtype: 'container' ,
                columnWidth: .33 ,
                defaults: {
                    xtype: 'textfield' ,
                    anchor: '100%'
                } ,
                items: [{
                    fieldLabel: 'age'
                } , {
                    fieldLabel: 'place'
                }]
            } , {
                xtype: 'container' ,
                columnWidth: .33 ,
                defaults: {
                    xtype: 'textfield' ,
                    anchor: '100%'
                } ,
                items: [{
                    fieldLabel: 'nickname'
                } , {
                    fieldLabel: 'whatever'
                }]
            }]
        }]
    }).show();
});

当您调整窗口大小时,每列也会调整大小,并且不会消失。

再见

威尔克