2014-11-24 82 views
0

我想獲得一個tabpanel內的gridpanel以適當的高度顯示。有問題的標籤是maincontentpanel3。現在,寬度可以達到100%,但高度似乎會持續到面板填滿爲止,超過頁面底部。GridPanel自動內部TabPanel的高度

即使將自動滾動設置爲自動,也不會出現滾動條。如果我給GridPanel1一個高度,除了(顯然)高度以外,一切正常。

這裏是精簡代碼:

<ext:Viewport runat="server" Layout="FitLayout"> 
    <Items> 
     <ext:Panel runat="server" ID="maincontentpanelwrapper" > 
      <Items> 
       <ext:TabPanel ID="maincontentpanel" runat="server" Layout="FitLayout"> 
        <Items> 
         <ext:Panel runat="server" ID="maincontentpanel1" > 
         </ext:Panel> 
         <ext:Panel runat="server" ID="maincontentpanel2" > 
         </ext:Panel> 
         <ext:Panel runat="server" ID="maincontentpanel3" > 
          <Items> 
           <ext:GridPanel ID="GridPanel1" AutoScroll="true" runat="server" > 
            <Store> 
             [REMOVED] 
            </Store> 
            <ColumnModel> 
             <Columns> 
              [REMOVED] 
             </Columns> 
            </ColumnModel> 
           </ext:GridPanel> 
          </Items> 
         </ext:Panel> 
        </Items> 
       </ext:TabPanel> 
      </Items> 
     </ext:Panel> 
    </Items> 
</ext:Viewport> 

這裏是在右下角發生的圖像(沒有滾動條,明確溢出)

enter image description here

謝謝您的幫助!

+0

我可以調查與測試案例的細節問題,如果你想要的。 – 2014-11-25 17:52:23

回答

1

我能想出如何做到這一點的唯一方法就是使用javascript。這是我想出的解決方案:

initialload2(); 
function initialload2() { 
    if (Ext.getCmp("GridPanel1")) { 
     if (window.innerHeight != undefined) { 
      var height = window.innerHeight; 
     } 
     else { 
      //for ie 
      var B = document.body, 
      D = document.documentElement; 
      var height = Math.min(D.clientHeight, B.clientHeight); 
     } 
     Ext.getCmp("GridPanel1").setHeight(height - 62); 
    } else { 
     setTimeout(initialload2, 100); 
    } 
} 

var resizeTimer; 
window.onresize = function() { 
    clearTimeout(resizeTimer); 
    resizeTimer = setTimeout(initialload2, 100); 
}; 
0

它可以使用標記修復。無需使用JavaScript。 我已經在ext.net 2.0上測試過,我認爲它也可以在舊版本上運行

只需在gridpanel和border中添加layout屬性即可。 下面的例子

<ext:GridPanel ID="GridPanel1" AutoScroll="true" runat="server" Layout="FitLayout" Border="true" > 

這就是給了它。希望你喜歡它