一种可能的解决方案是使用行容器并将面板布局更改为
'vbox'
:
Ext.define('MyApp.view.main.Date', {
extend: 'Ext.Panel',
xtype: "secondrow",
layout: {
type: 'vbox',
pack: 'center'
},
items: [{
xtype: 'container',
layout: 'hbox',
items: [{
margin: '0 50 0 50',
padding: '10 20 10 20',
xtype: 'datefield',
anchor: '100%',
fieldLabel: 'Start date',
name: 'startDate',
maxValue: new Date()
}, {
margin: '0 50 0 50',
padding: '10 20 10 20',
xtype: 'timefield',
name: 'startTime',
fieldLabel: 'Start Time',
minValue: '6:00 AM',
maxValue: '8:00 PM',
increment: 30,
anchor: '100%'
}]
}, {
xtype: 'container',
layout: 'hbox',
items: [{
margin: '0 50 0 50',
padding: '10 20 10 20',
xtype: 'datefield',
anchor: '100%',
fieldLabel: 'End date',
name: 'endDate',
maxValue: new Date(),
}, {
margin: '0 50 0 50',
padding: '10 20 10 20',
xtype: 'timefield',
name: 'endTime',
fieldLabel: 'EndTime',
minValue: '6:00 AM',
maxValue: '8:00 PM',
increment: 30,
anchor: '100%'
}]
}]
});