2012-05-16 17 views
0

我有這樣的代碼ExtJS的窗口犯規表演元件以及在IE

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%,使主容器在按下分機JS菜單按鈕oppened。 而主容器被放置在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比包含它們的一個更寬。爲什麼IE生成不好?這不會發生在Chrome和FF中。

+0

這個問題是相當含糊。柱子是如何構造的?容器是否呈現給放置在另一個容器中的元素?什麼版本的Ext4? –

+0

是的,extjs 4.列也是類型Ext.container.Container – Vlad

+0

我的觀點是,爲什麼讓它成爲猜謎遊戲?發佈一個演示你的問題的例子。 –

回答

1

如果這種情況只發生在IE瀏覽器中,您是否考慮過放棄IE作爲瀏覽器?除了IE瀏覽器之外,如果它在任何瀏覽器中都可以工作,那麼可能是一個bug,或者只能爲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(); 
}); 

當你調整窗口的大小,每列被調整過,沒有人會消失。

威爾克

+0

我和你做同樣的事情,但不同之處在於我在創建主容器之前創建了列。創作的順序會有問題嗎? – Vlad

+0

我試過了你的測試,但它的工作原理是一樣的。現在我無法測試IE,因爲我在Linux機器上工作,我懶得模擬它。但是,如果它適用於任何瀏覽器,請在Sencha Forum上詢問它是否爲錯誤。也許,在IE上,列布局的處理方式不同......我不知道,對不起。 – Wilk

+0

好的。我通過HTML代碼預測了IE9中的主容器,發現第三列的寬度比我放入列容器中的組件小10-13個像素。這是什麼造成的? – Vlad