【问题标题】:ExtJs - Set a fixed width in a center layout in a PanelExtJs - 在面板的中心布局中设置固定宽度
【发布时间】:2011-01-26 05:34:00
【问题描述】:

使用 ExtJs。

我正在尝试设计一个主面板,它分为三个子面板(树列表、网格和面板)。它的工作方式是您有一个包含元素的树列表(西),单击填充网格(中心)的元素,然后单击网格中的一个元素并生成面板(西)。

包含其他三个面板的主面板已定义为布局“边框”。

现在我面临的问题是中心布局(网格)已在代码中定义为固定宽度,而西面板则定义为自动宽度。但是当界面生成时,网格宽度突然占据了界面中的所有空间,而不是西面板。

代码如下:

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]
});

这里的“var exploits”是我的主面板,包含其他三个子面板。

“exploits_tree”是包含一些元素的树列表。当您单击其中一个元素时,将填充网格“exploit_commands”,当您单击其中一个填充元素时,将生成“exploits_details_panel”面板。

如何在“exploit_commands”上设置固定宽度?

感谢您的宝贵时间。

【问题讨论】:

    标签: javascript layout extjs height panel


    【解决方案1】:

    根据docs,中心区域不能有固定宽度(参见Notes 标题下的第一个项目符号点)。任何其他区域(N、S、E 或 W)都可以定义其大小,并且中心区域仅占用剩余的空间。顺便说一句,这也是其他 GUI 平台中这种布局风格的标准方法(或者考虑一下您用作示例的任何图形 IDE)。

    不要在你的东面板上设置自动宽度,给它一个定义的起始宽度(否则它不会显示,这可能就是你所看到的)。

    【讨论】:

      猜你喜欢
      • 2015-10-09
      • 2012-01-07
      • 2014-01-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-22
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多