gpt4 book ai didi

javascript - 为什么滚动条没有出现这段extjs代码?

转载 作者:行者123 更新时间:2023-11-30 09:03:39 26 4
gpt4 key购买 nike

我在测试 Accordion 布局时遇到了问题,这是代码

var myData = [
['3m Co', 71.72, 0.02, 0.03, '9/1 12:00am'],
['Alcoa Inc', 29.01, 0.42, 1.47, '9/1 12:00am'],
['Altria Group Inc', 83.81, 0.28, 0.34, '9/1 12:00am'],
['American Express Company', 52.55, 0.01, 0.02, '9/1 12:00am'],
['American International Group, Inc.', 64.13, 0.31, 0.49, '9/1 12:00am'],
['AT&T Inc.', 31.61, -0.48, -1.54, '9/1 12:00am'],
['Boeing Co.', 75.43, 0.53, 0.71, '9/1 12:00am'],
['Caterpillar Inc.', 67.27, 0.92, 1.39, '9/1 12:00am'],
['Citigroup, Inc.', 49.37, 0.02, 0.04, '9/1 12:00am'],
['E.I. du Pont de Nemours and Company', 40.48, 0.51, 1.28, '9/1 12:00am'],
['Exxon Mobil Corp', 68.1, -0.43, -0.64, '9/1 12:00am'],
['General Electric Company', 34.14, -0.08, -0.23, '9/1 12:00am']
];

var store = Ext.create('Ext.data.ArrayStore', {
fields: [
{name: 'company'},
{name: 'price', type: 'float'},
{name: 'change', type: 'float'},
{name: 'pctChange', type: 'float'},
{name: 'lastChange', type: 'date', dateFormat: 'n/j h:ia'}
],
data: myData
});


Ext.create('widget.window', {
title: 'Activity',
closable: true,
closeAction: 'hide',
width: 250,
height: 300,
bodyBorder: true,
tbar: {
xtype: 'toolbar',
ui: 'plain',
items: [{
iconCls:'refresh'
},
'->',
{
xtype: 'displayfield',
name: 'act_date',
id: 'act_date',
value: '2011-08-08'
}]
},
layout:'accordion',
border: false,
items: [{
title: 'Recent activity',
items: [{
xtype: 'grid',
store: store,
hideHeaders: true,
border: 0,
autoScroll: true,
columns: [{
text : 'Company',
flex : 1,
sortable : false,
dataIndex: 'company'
},{
text : 'Price',
width : 75,
sortable : true,
renderer : 'usMoney',
dataIndex: 'price'
}]

}]
},{
title: 'Recent activity',
html: ''
},{
title: 'Recent activity',
html: ''
}]

}).show();

输出是这样的

enter image description here

滚动条没有出现在网格中。知道为什么没有吗?

问候

solution1 = Kiran 的答案解决方案2 = http://jsfiddle.net/MmBWF/

最佳答案

您需要为要显示数据的网格指定高度。然后它会计算高度,在溢出时会显示滚动条。

检查以下链接:

http://jsfiddle.net/NswjV/

关于javascript - 为什么滚动条没有出现这段extjs代码?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6981511/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com