我正在编写一个应用程序,我的整个页面都有BorderLayout。在南部我有一个Panel,我添加了FormPanels。我希望能够滚动该面板,以便我可以滚动FormPanels。
到目前为止,我从搜索中找到的任何内容都没有帮助。我不太了解ExtJS在LayoutManagers的组合方面需要什么,设置大小和设置AutoScroll。
任何部分提示都将非常感激。
代码段:
new Ext.Viewport({
layout: "border",
items: [{
region: "north",
contentEl: "title",
height: 50
}, {
region: "center",
id: "mappanel",
title: "Map",
xtype: "gx_mappanel",
map: map,
layers: [layer],
extent: extent,
split: true,
tbar: toolbarItems
}, {
region: "east",
title: "Details",
width: 300,
split: true,
id: "east-panel",
laout: 'fit'
}, {
region: "south",
id: "south-panel",
height: 200
}, {
region: "west",
id: "west-panel",
width: 300
}]
});
matchedTrailJunctionsPanel = new Ext.Panel({
title: "Matched Trail Junctions2",
id: "matched-trail-junctions",
autoScroll:true
//layout: 'anchor'
});
var southPanel = Ext.getCmp('south-panel');
southPanel.add(matchedTrailJunctionsPanel);
southPanel.doLayout();
createTrailJunctionPanel = function(trailJunction) {
var trailJunctionPanel = new Ext.form.FormPanel({
labelWidth: 75,
width: 350,
defaultType: 'textfield',
items: [{
fieldLabel: 'Junction Name',
name: 'junction-name'
}],
autoScroll:true,
//anchor: '100% 100%',
height: 100
});
matchedTrailJunctionsPanel.add(trailJunctionPanel);
if(trailJunction.publicTrailSegments.length == 0) {
matchedTrailJunctionsPanel.add(new Ext.form.Label({text: 'No public trails matched'}));
} else {
var grid = new Ext.grid.GridPanel({
store: mapMatchObjectStore,
columns: [
{id:'publicTrailSegment',header: 'Trail', width: 160, sortable: true, dataIndex: 'publicTrailSegment'}
],
stripeRows: true,
autoExpandColumn: 'publicTrailSegment',
height: 350,
width: 600,
title: 'Matched Trail Junctions'
});
matchedTrailJunctionsPanel.add(grid);
}
matchedTrailJunctionsPanel.doLayout();
}
答案 0 :(得分:2)
您的南面板是您的组件的主要容器,因此它应该是autoScroll:true
,您应该将表单和网格添加到其中。您无法直接将网格添加到FormPanel中,因为它不是表单字段(您必须将其包装为Field或实现Field的某些界面)。它可能适用于没有布局的南方(浏览器应该直接在表单之后粘贴网格)但通常最好指定适当的布局(在这种情况下vbox
将是一个好的布局。)
答案 1 :(得分:1)
包含面板必须设置高度。包含的面板必须设置高度或设置autoHeight: true
。