Макет vbox полевого контейнера ExtJS 4.2
Вопрос
У меня есть форма, в которой есть полевой контейнер с layout: {type:'vbox'}
.
Мне нужно разместить два поля в одной строке, но radiogroup
выровнено неправильно.(Для лучшего понимания я прикрепил изображение).
Код формы следующий:
{
xtype: 'datefield',
fieldLabel: 'Date',
format: 'd/m/Y',
submitFormat: 'Y-m-d H:i:s',
allowBlank: false,
disabled: true,
value: new Date()
}, {
xtype: 'fieldcontainer',
fieldLabel: 'Type',
combineErrors: true,
defaults: {
hideLabel: true
},
layout: {
type: 'vbox'
},
items: [{
xtype: 'combobox',
width: 90,
store: Ext.create('HolidayType', {
autoLoad: true
}),
displayField: 'Description',
valueField: 'HolidayTypeId',
queryMode: 'local',
allowBlank: false,
}, {
xtype: 'radiogroup',
columns: 2,
items: [{
boxLabel: 'Official',
name: 'RequestInAdvance',
inputValue: 0,
checked: true
}, {
boxLabel: 'Personal',
name: 'RequestInAdvance',
inputValue: 1
}
]
}]
}, {
xtype: 'radiogroup',
fieldLabel: 'Request',
anchor: '70%',
columns: 2,
items: [{
boxLabel: 'Payable',
name: 'Request',
inputValue: 0,
checked: true
}, {
boxLabel: 'Non Payable',
name: 'Request',
inputValue: 1
}
]
},
Любая подсказка о том, как я могу получить желаемое поведение?
ОБНОВЛЯТЬ
Вот скрипка сенча: https://fiddle.sencha.com/#fiddle/8ch
Решение
Вам необходимо указать ширину либо для ваших столбцов, либо для всей группы переключателей:
xtype: 'radiogroup',
width: 200,
columns: 2,
items: [
{ boxLabel: 'Official', name: 'Request1', inputValue: 0, checked: true },
{ boxLabel: 'Personal', name: 'Request1', inputValue: 1 }
]
Посмотрите на скрипку: https://fiddle.sencha.com/#fiddle/8cj
Другие советы
Решено:
Решением было назначить каждому радиоэлементу фиксированную ширину или гибкость:
Вот скрипка: https://fiddle.sencha.com/#fiddle/8ci
items: [{
boxLabel: 'Official',
width: 80,
padding: '0 0 0 22',
name: 'Request1',
inputValue: 0,
checked: true
}, {
boxLabel: 'Personal',
flex: 1,
name: 'Request1',
inputValue: 1
}
]
Не связан с StackOverflow