我有一个 Ext 窗口,其中有两个项目容器和字段集。对于容器和字段集,我从服务器获取 html 形式的数据。
如果这个数据很大,会出现滚动条,不能完全导航文本。
如何在此面板中正确配置垂直滚动条?
我的示例代码是:
Ext.create('Ext.window.Window', {
title: 'DataSet',
bodyPadding: 5,
modal: true,
height: 600,
width: 900,
layout: 'fit',
items: {
xtype: 'form',
items: [{
xtype: 'container',
html: jsonData.R.ErrorMsg || ''
}, {
xtype: 'fieldset',
padding: '5 0 10 0',
collapsible: true,
title: 'Description',
autoScroll: true,
height: 580,
width: 880,
collapsed: true,
overflowY: 'scroll',
html: Ext.String.htmlEncode(jsonData.R.ErrorDesc) || ''
}]
}
})
最佳答案
问题是您正在为字段集设置固定的宽度和高度。如果您只想在内容超过窗口大小时才使用滚动条,您首先需要将字段集大小设置为 flex。
- 在表单中使用
vbox
布局 - 将字段集中固定的
height: 580
和width: 880
替换为flex: 1
这是一个有效的 fiddle :https://fiddle.sencha.com/#view/editor&fiddle/30f9
关于javascript - ExtJS 垂直滚动条不适合长 json 数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36469272/