窗口中包含 2 个项目的 extjs 间距问题
我有一个像这样的 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);
}
}]
});
有 2 个项目:detailGrid(GridPanel) 和 msgDetailsPanel(Ext.ux.ManagedIFrame.Panel)。
现在,当窗口呈现时,即使网格只有 1 个项目,detailGrid 也会占用大量垂直空间,并且我需要向下滚动才能看到 msgDetailsPanel。我怎样才能让这两个项目根据其内容自动调整大小?
I have an extjs window object like this:
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);
}
}]
});
There are 2 items: detailGrid(GridPanel) and msgDetailsPanel(Ext.ux.ManagedIFrame.Panel).
Now when the window renders, the detailGrid takes up a lot of vertical space even if the grid has only 1 item and i need to scroll down to see the msgDetailsPanel. How can i make these 2 items auto adjust the size based on their contents?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
只需为
grid
和ManagerIFramePanel
设置autoHeight : true
并删除它们的height
属性。然后,网格
和面板
将仅占用其子项
或网格行
所需的空间。Simply set the
autoHeight : true
for both thegrid
and theManagerIFramePanel
and remove theheight
property of both of them. Then thegrid
and thepanel
will take up only as much space as required by theirchild items
orgrid rows
.我认为最好的方法是:
layout
for win;网格的center
区域和面板的south
区域。height = win.height - grid.getStore().getCount() * 25 - 30;
split = true
i think best way is:
layout
for win;center
region for grid andsouth
for panel.height = win.height - grid.getStore().getCount() * 25 - 30;
split = true
for panel原因实际上是因为您在窗口本身上设置了布局:“适合”,它应该只支持跨越面板的整个高度和宽度的单个项目。使用布局:“auto”,或者“vbox”/“hbox”。
The reason is actually because you have layout: 'fit' set on the window itself, which is supposed to support just a single item spanning the whole height and width of the panel. Use layout: 'auto', or maybe 'vbox' / 'hbox'.