PDA

View Full Version : Align TextField and CheckBox Next to each other



justinn
18 Nov 2010, 12:28 AM
I have a fieldset with textfield checkbox pairs,

how do i align them in rows so that i have
[TEXTBOX] [CHECKBOX]
[TEXTBOX] [CHECKBOX]
[TEXTBOX] [CHECKBOX]




{
xtype:'fieldset',
checkboxToggle:true,
title: 'title',
id: 't_panel',
autoHeight:true,
defaultType: 'textfield',
items :[

{
fieldLabel: 'Text1',
name: 'text1'
}
{
xtype:'checkbox',
fieldLabel: 'CB1',
name: 'CB1'
},
{
fieldLabel: 'Text2',
name: 'text2'
},
{
xtype:'checkbox',
fieldLabel: 'C2',
name: 'C2'
},
{
fieldLabel: 'Text3',
name: 'text3'
},
{
xtype:'checkbox',
fieldLabel: 'C3',
name: 'C3'
}
]
},

justinn
18 Nov 2010, 9:00 AM
bump for some urgent help.

evant
18 Nov 2010, 9:24 AM
You want to use a hbox layout.

FYI this is the touch forums, not the Ext ones, so I'll move your post.

Screamy
18 Nov 2010, 9:52 AM
Also take a look at Ext.form.CompositeField.

justinn
18 Nov 2010, 11:20 AM
Almost there, i get them to aligh next to each other but the labels combine infront of the first item

There is no label on the composite field, so why is it still doing that?



{
xtype : 'compositefield',
items : [
{
xtype:'textfield',
fieldLabel: 'text1',
name: 'text1,'
flex:1,
width:100
},
{
xtype:'checkbox',
fieldLabel: 'check1',
name: 'check1',
}
]
}

Screamy
19 Nov 2010, 11:05 AM
The CompositeField is used where you want a field layout something like this:



City/State/Zip: Smegmaville CA 94707

LostSoul
19 Nov 2010, 1:56 PM
read the api's

use boxLabel to move the label on a checkbox to the otherside.