我有一个页面,该页面上创建了3个元素,并使用#parse从另一个脚本文件加载了第4个元素(D)。我想做的就是强制表格布局像这样对齐它们
____ ___
| A | |
|____| |
| B | D |
|____| |
| C | |
|____|___|
有可能吗?如果是,怎么办?
我尝试使用colspan和rowpan无济于事。
答案 0 :(得分:1)
items: [{
html: 'Cell A content'
}, {
html: 'Cell B content',
rowspan: 3
}, {
html: 'Cell C content'
}, {
html: 'Cell D content'
}]
答案 1 :(得分:1)
您可以通过使用flex来专门使用布局。
示例代码:
Ext.application({
name: 'Fiddle',
launch: function () {
Ext.Viewport.add({
xtype: 'panel',
title: 'Flexbox Layout Example',
items: [{
xtype: 'panel',
layout: {
type: 'hbox',
pack: 'start',
align: 'stretch'
},
height: '100%',
border: 1,
items: [{
xtype: 'panel',
flex: 1,
layout: {
type: 'vbox',
pack: 'start',
align: 'stretch'
},
items: [{
xtype: 'panel',
flex: 1,
html: 'Panel 1',
border: 1,
}, {
xtype: 'panel',
flex: 1,
html: 'Panel 2',
border: 1,
}, {
xtype: 'panel',
flex: 1,
html: 'panel 3',
border: 1,
}]
}, {
html: 'panel D',
xtype: 'panel',
flex: 1,
border: 1,
}]
}]
});
}
});