1

does anyone know how to align a togglefield in Sencha Touch 2 to the right side of the fieldset component? Having this simple example:

Ext.widget("fieldset", {
    items: [
        {
            xtype: 'togglefield',
            label: 'Toggle 1',
        },
        {
            xtype: 'togglefield',
            label: 'Toggle 2'
        }
    ]
});

The ouput looks fine except of the fact the the two togglefields are aligned to the left side just next to the label text. I would like to have them aligned to the right side of the fieldset component.

olegtaranenko
  • 3,722
  • 3
  • 26
  • 33
Pavel Stupka
  • 213
  • 2
  • 14

1 Answers1

2

Try this

Ext.widget("fieldset", {
    items: [
        {
            xtype: 'togglefield',
            cls:'rightAligned',
            label: 'Toggle 1',
        },
        {
            xtype: 'togglefield',
            label: 'Toggle 2'
        }
    ]
});

And add a style like

.rightAligned .x-toggle {
    float:right;
    margin-right:1em;
}    
blessanm86
  • 31,439
  • 14
  • 68
  • 79