PDA

View Full Version : RadioGroup with additional fields



cjauvin
5 Nov 2012, 10:33 AM
Is there a pattern (or even an already defined widget that I might have overlooked) that would help with embedding extra fields (text/number/date) in a RadioGroup (i.e. beside the labels, and maybe even with automatic disabling of unckecked items)? I have assembled a custom solution, but it's full of nested panels, and not terribly elegant.

tvanzoelen
6 Nov 2012, 2:12 AM
You could try to use the form.FieldContainer to group fields. The interaction between the fields you probabaly have to implement yourself.

cjauvin
6 Nov 2012, 6:23 AM
Thanks. I saw this, but the big warning note in the doc scared me way.. Would you have an example of code using it?

tvanzoelen
6 Nov 2012, 6:30 AM
Where is that warning?

In the docs there is sample code http://docs.sencha.com/ext-js/4-1/#!/api/Ext.form.FieldContainer

Also here an example with radiobuttons

http://docs.sencha.com/ext-js/4-1/#!/api/Ext.form.field.Radio

In the part here


items: [
{
boxLabel : 'M',
name : 'size',
inputValue: 'm',
id : 'radio1'
}, {
boxLabel : 'L',
name : 'size',
inputValue: 'l',
id : 'radio2'
}, {
boxLabel : 'XL',
name : 'size',
inputValue: 'xl',
id : 'radio3'
}
]

you can add other kind of fields like a text field



{
xtype: 'textfield',
name: 'email',
fieldLabel: 'Email Address',
vtype: 'email' // requires value to be a valid email address format
}

cjauvin
6 Nov 2012, 6:38 AM
You're right: I was mistakenly looking at http://docs.sencha.com/ext-js/4-1/#!/api/Ext.layout.component.field.FieldContainer, which is a private class. Thanks again.