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

发布于 2024-12-03 09:18:36 字数 588 浏览 2 评论 0原文

我有一个像这样的 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

长梦不多时 2024-12-10 09:18:36

只需为 gridManagerIFramePanel 设置 autoHeight : true 并删除它们的 height 属性。然后,网格面板将仅占用其子项网格行所需的空间。

Simply set the autoHeight : true for both the grid and the ManagerIFramePanel and remove the height property of both of them. Then the grid and the panel will take up only as much space as required by their child items or grid rows.

错爱 2024-12-10 09:18:36

我认为最好的方法是:

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

i think best way is:

  1. use border layout for win; center region for grid and south for panel.
  2. set panel height = win.height - grid.getStore().getCount() * 25 - 30;
  3. set split = true for panel
亽野灬性zι浪 2024-12-10 09:18:36

原因实际上是因为您在窗口本身上设置了布局:“适合”,它应该只支持跨越面板的整个高度和宽度的单个项目。使用布局:“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'.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文