سؤال

لدي نموذج يحتوي على حاوية ميدانية مع layout: {type:'vbox'}.

أحتاج إلى وضع حقلين في نفس السطر ولكن radiogroup لم يتم محاذاة بشكل صحيح.(لقد أرفقت الصورة لفهم أفضل).

enter image description here

رمز النموذج هو التالي:

{
    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
    }

]
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top