2010-03-11 61 views
0

在設置在一箇中心佈局固定寬度使用ExtJs的。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] 
}); 

這裏「變種攻擊」是我含其他三個子面板主面板。

在「exploits_tree」是含有某些要素的樹列表。當你點擊其中一個元素時,網格'exploit_commands'被填充,當你點擊其中一個填充元素時,會生成'exploits_details_panel'面板。

我如何可以設置「exploit_commands」固定寬度?

謝謝你的時間。

回答

3

根據docs,中心區域不能具有固定寬度(請參閱注意標題下的第一個項目符號點)。任何其他區域(N,S,E或W)都可以定義其大小,並且中心區域可以簡單地佔據剩下的空間。順便說一句,這對於其他GUI平臺中的這種佈局風格來說也是一種標準方法(或者想想幾乎所有用作示例的圖形化IDE)。

不要在東面板上設置自動寬度,給它一個定義的開始寬度(否則它不會顯示,這可能是你所看到的)。