ExtJs - 在面板的中心布局中设置固定宽度
使用 ExtJ。
我正在尝试设计一个主面板,它分为三个子面板(树列表、网格和面板)。它的工作方式是,您有一个包含元素的树列表(西),单击填充网格(中心)的元素,然后单击网格中的一个元素并生成面板(西)。
我的包含其他三个面板的主面板已使用布局“边框”定义。
现在我面临的问题是中心布局(网格)已在代码中定义为固定宽度,而西面板为自动宽度。但是当界面生成时,网格宽度突然占据了界面中的所有空间,而不是西面板。
代码如下所示:
var exploits_details_panel = new Ext.Panel({
region: 'east',
autoWidth: true,
autoScroll: true,
html: 'test'
});
var exploit_commands = new Ext.grid.GridPanel({
store: new Ext.data.Store({
autoDestroy: true
}),
sortable: true,
autoWidth: false,
region: 'center',
stripeRows: true,
autoScroll: true,
border: true,
width: 225,
columns: [
{header: 'command', width: 150, sortable: true},
{header: 'date', width: 70, sortable: true}
]
});
var exploits_tree = new Ext.tree.TreePanel({
border: true,
region: 'west',
width: 200,
useArrows: true,
autoScroll: true,
animate: true,
containerScroll: true,
rootVisible: false,
root: {nodeType: 'async'},
dataUrl: '/ui/modules/select/exploits/tree',
listeners: {
'click': function(node) {
}
}
});
var exploits = new Ext.Panel({
id: 'beef-configuration-exploits',
title: 'Auto-Exploit',
region: 'center',
split: true,
autoScroll: true,
layout: {
type: 'border',
padding: '5',
align: 'left'
},
items: [exploits_tree, exploit_commands, exploits_details_panel]
});
这里“varexploits”是我的主面板,包含其他三个子面板。
“exploits_tree”是包含一些元素的树列表。当您单击其中一个元素时,会填充网格“exploit_commands”,当您单击其中一个填充元素时,会生成“exploits_details_panel”面板。
如何在“exploit_commands”上设置固定宽度?
感谢您抽出时间。
Using ExtJs.
I'm trying to design a main which is divided into three sub panels (a tree list, a grid and a panel). The way it works is that you have a tree list (west) with elements, you click on an element which populates the grid (center), then you click on an element in the grid and that generates the panel (west).
My main panel containing the three other ones has been defined with a layout 'border'.
Now the problem I face is that the center layout (the grid) has been defined in the code with a fixed width and the west panel as an auto width. But when the interface gets generated, the grid width is suddenly taking all the space in the interface instead of the west panel.
The code looks like that:
var exploits_details_panel = new Ext.Panel({
region: 'east',
autoWidth: true,
autoScroll: true,
html: 'test'
});
var exploit_commands = new Ext.grid.GridPanel({
store: new Ext.data.Store({
autoDestroy: true
}),
sortable: true,
autoWidth: false,
region: 'center',
stripeRows: true,
autoScroll: true,
border: true,
width: 225,
columns: [
{header: 'command', width: 150, sortable: true},
{header: 'date', width: 70, sortable: true}
]
});
var exploits_tree = new Ext.tree.TreePanel({
border: true,
region: 'west',
width: 200,
useArrows: true,
autoScroll: true,
animate: true,
containerScroll: true,
rootVisible: false,
root: {nodeType: 'async'},
dataUrl: '/ui/modules/select/exploits/tree',
listeners: {
'click': function(node) {
}
}
});
var exploits = new Ext.Panel({
id: 'beef-configuration-exploits',
title: 'Auto-Exploit',
region: 'center',
split: true,
autoScroll: true,
layout: {
type: 'border',
padding: '5',
align: 'left'
},
items: [exploits_tree, exploit_commands, exploits_details_panel]
});
Here 'var exploits' is my main panel containing the three other sub panels.
The 'exploits_tree' is the tree list containing some elements. When you click on one of the elements the grid 'exploit_commands' gets populated and when you click in one of the populated elements, the 'exploits_details_panel' panel gets generated.
How can I set a fixed width on 'exploit_commands'?
Thanks for your time.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
根据文档,中心区域不能,具有固定宽度(请参阅注释标题下的第一个项目符号点)。任何其他区域(N、S、E 或 W)都可以定义其大小,而中心区域只需占据剩余的空间。顺便说一句,这几乎也是其他 GUI 平台中这种布局风格的标准方法(或者以您使用的任何图形 IDE 作为示例)。
不要在东面板上设置自动宽度,而是给它一个定义的起始宽度(否则它将不会显示,这可能就是您所看到的)。
The center region cannot, according to the docs, have a fixed width (see the first bullet point under the Notes heading). Any other region (N, S, E or W) may define its size, and the center region simply takes up whatever space is left over. BTW, this is pretty much a standard approach for this style of layout in other GUI platforms too (or think of just about any graphical IDE you've used as an example).
Don't set auto width on your east panel, give it a defined starting width (otherwise it will not show, which is probably what you're seeing).