I would like to get all of the checked items in a checkboxgroup that is part of a formpanel. Ultimately they would be saved back to database as a string, ma separated value format.
Thanks for any guidance or assistance you can provide.
Here is how I have my group defined:
new Ext.form.CheckboxGroup({
id: 'newId',
fieldLabel: 'Group A',
name: 'broker',
allowBlank: false,
columns: 1,
items: [{
boxLabel: 'All',
name: 'all',
id: 'null'
},
{
boxLabel: 'FS',
name: 'fs',
id: '1'
},
{
boxLabel: 'Royal A',
name: 'ra',
id: '2'
},
{
boxLabel: 'Point',
name: 'sp',
id: '6'
}]
})
I would like to get all of the checked items in a checkboxgroup that is part of a formpanel. Ultimately they would be saved back to database as a string, ma separated value format.
Thanks for any guidance or assistance you can provide.
Here is how I have my group defined:
new Ext.form.CheckboxGroup({
id: 'newId',
fieldLabel: 'Group A',
name: 'broker',
allowBlank: false,
columns: 1,
items: [{
boxLabel: 'All',
name: 'all',
id: 'null'
},
{
boxLabel: 'FS',
name: 'fs',
id: '1'
},
{
boxLabel: 'Royal A',
name: 'ra',
id: '2'
},
{
boxLabel: 'Point',
name: 'sp',
id: '6'
}]
})
Share
Improve this question
asked Dec 7, 2010 at 16:33
PixelMusePixelMuse
4708 silver badges24 bronze badges
2 Answers
Reset to default 5Use CheckBoxGroup
's getValue()
method. From the API docs:
getValue():
Gets an array of the selected Ext.form.Checkbox in the group.
Returns: An array of the selected checkboxes.
You can then call join(",")
on the returned Array to get a ma-separated list.
Did you tried getChecked for getting all checked boxes.
DescCheck.getChecked();
You should use getValue(), It returns the array of selected values.
You can get that by looping through array like this
var selectedValue= DescCheckGroup.getChecked();
for(var i=0;i<selectedValue.length;i++){
console.log(select[i].inputValue);
}
Please see the following answers: https://stackoverflow./a/27414218/2935802 https://stackoverflow./a/18309126/2935802