窗口中的extjs间距问题有2个项目

时间:2011-09-06 20:11:07

标签: extjs extjs3

我有一个像这样的extjs窗口对象:

win = new Ext.Window({
layout:'fit', 
title: '<spring:message code="title.alertDetails" />',
autoDestroy: true,
autoScroll: true,
width:600,
height:400,
closable:false,
plain: true,
items: [detailGrid,msgDetailsPanel],
buttons: [{
text: '<spring:message code="label.button.close" />',
handler: function(){
win.hide(this);
}
}]
});

有两项:detailGrid(GridPanel)和msgDetailsPanel(Ext.ux.ManagedIFrame.Panel)。

现在当窗口渲染时,即使网格只有1个项目,detailGrid也会占用大量的垂直空间,我需要向下滚动才能看到msgDetailsPanel。如何根据内容自动调整这两个项目?

3 个答案:

答案 0 :(得分:1)

我认为最好的方法是:

  1. 使用border layout获胜;网格的center区域和面板的south
  2. 设置面板height = win.height - grid.getStore().getCount() * 25 - 30;
  3. 为面板设置split = true

答案 1 :(得分:1)

只需为autoHeight : truegrid设置ManagerIFramePanel,然后删除这两者的height属性。然后,gridpanel只会占用child itemsgrid rows所需的空间。

答案 2 :(得分:0)

原因实际上是因为你有布局:'fit'设置在窗口本身,它应该只支持跨越面板整个高度和宽度的单个项目。使用布局:'auto',或者'vbox'/'hbox'。