PDA

View Full Version : Allignment of items inside a fieldset



amerello
26 Sep 2012, 6:46 AM
Is it possible to align all items inside a fieldset to the width of the longest?
I have the following fieldset with a checkbox and two textfields, I'd like the fieldset to align itself automatically to the longest label ( the checkbox in this case) like a form to the position of the redline.
Currently the labelStyle for the checkboxes and textfield is set to : white-space: nowrap;width: auto;

38951

Thanks!

scottmartin
26 Sep 2012, 7:43 AM
Please try the following:



Ext.define('MyApp.view.MyForm', {
extend: 'Ext.form.Panel',

width: 448,
defaults: {
labelWidth: 200
},
bodyPadding: 10,
title: 'My Form',

initComponent: function() {
var me = this;

Ext.applyIf(me, {
items: [
{
xtype: 'checkboxfield',
anchor: '100%',
fieldLabel: 'Fast Frequency Sweep (Adaptive)'
},
{
xtype: 'textfield',
anchor: '100%',
fieldLabel: 'Maximum Sweep Points'
},
{
xtype: 'textfield',
anchor: '100%',
fieldLabel: 'Threshold'
}
]
});

me.callParent(arguments);
}

});

Ext.create('MyApp.view.MyForm', {
renderTo: Ext.getBody()
});


Scott​