我有一个tabpanel.在选项卡中,我有一个面板,其中包含一个工具栏和3个项目:[fieldset,gridpanel和另一个fieldset(或一些按钮)].我无法让gridpanel显示滚动条.它只适用于我设置gridpanel的maxheight/minheight.
我也尝试在一个容器内包装gridpanel.没运气.在示例中,我使用适合布局.我尝试了"锚"布局,并为gridpanel指定了锚:'100%50%',希望在我调整浏览器大小时它会调整大小.没运气.
或者,如果gridpanel是选项卡中的唯一项目,则autoscroll将起作用.所以它出现在另一个面板中时,自动滚动/调整大小不起作用.
我在这里错过了什么吗?
Ext.application({
name: 'MyApp',
launch: function () {
// create the data store
var d = ['company', 100];
var myData = [];
for (var i = 0; i < 50; i++) {
myData[i] = d;
}
var store = Ext.create('Ext.data.ArrayStore', {
fields: [{
name: 'company'
}, {
name: 'price',
type: 'float'
}],
data: myData
});
Ext.create("Ext.container.Viewport", {
layout: {
type: 'border'
},
items: [{
xtype: 'toolbar',
id: 'headerbar',
region: 'north',
height: 30
}, {
xtype: 'toolbar',
id: 'menubar',
region: 'north',
height: 30
}, {
xtype: 'tabpanel',
itemId: 'maintabpanel',
activeTab: 0,
region: 'center',
plain: true,
margins: '5 5 5 5',
layout: 'fit',
items: [{
closable: false,
title: 'Tab',
margins: '0 0 0 0',
items: [{
xtype: 'panel',
title: 'Panel',
layout: 'fit',
tools: [{
type: 'help',
tooltip: 'Help'
}, {
type: 'close',
tooltip: 'Close'
}],
items: [{
xtype: 'fieldset',
title: 'Field Set',
layout: 'hbox',
items: [{
xtype: 'textfield',
fieldLabel: 'Input'
}]
}, {
xtype: 'gridpanel',
autoScroll: true,
store: store,
columns: [{
text: 'Company',
flex: 1,
sortable: true,
dataIndex: 'company'
}, {
text: 'Price',
flex: 1,
sortable: true,
dataIndex: 'price'
}],
viewConfig: {
autoFit: true
}
}, {
xtype: 'fieldset',
title: 'Field Set 2',
layout: 'hbox',
items: [{
xtype: 'textfield',
fieldLabel: 'Output'
}]
}]
}]
}]
}, {
xtype: 'box',
id: 'footer',
region: 'south',
html: '<h1> Copyright 2012</h1>',
height: 30
}]
});
}
});
Run Code Online (Sandbox Code Playgroud)
请注意,gridpanel 的父面板具有fit布局,但它具有多个项目(字段集、gridpanel 和另一个字段集)。一个fit布局只能有 1 个子布局。
此外,该面板的父面板fit(带有closable : false选项卡的面板)没有布局定义。
这是代码的 JsFiddle 修改版本,可以正常工作。
| 归档时间: |
|
| 查看次数: |
9648 次 |
| 最近记录: |