PDA

View Full Version : Change RadioGroup items dynamically



gtsafas
6 Jun 2012, 10:50 AM
Hi, I have scowered and have not found a way to do this. I am using a RaidoGroup and I want to power it from a store or at least be able to change the items to my own list that I pass in. I am getting a list from json of items which I want to make a radiogroup from. This list changes so I would like to push it over. Is there no way to do this:-/

scottmartin
7 Jun 2012, 1:46 PM
You can use setValue:



var form = Ext.create('Ext.form.Panel', {
title: 'RadioGroup Example',
width: 300,
height: 125,
bodyPadding: 10,
renderTo: Ext.getBody(),
items:[{
xtype: 'radiogroup',
itemId: 'rg',
fieldLabel: 'Two Columns',
// Arrange radio buttons into two columns, distributed vertically
columns: 2,
vertical: true,
items: [
{ boxLabel: 'Item 1', name: 'rb', inputValue: '1' },
{ boxLabel: 'Item 2', name: 'rb', inputValue: '2', checked: true},
{ boxLabel: 'Item 3', name: 'rb', inputValue: '3' },
{ boxLabel: 'Item 4', name: 'rb', inputValue: '4' },
{ boxLabel: 'Item 5', name: 'rb', inputValue: '5' },
{ boxLabel: 'Item 6', name: 'rb', inputValue: '6' }
]
}]
});

rg = form.down('#rg');
rg.setValue({rb: ['5']});


Regards,
Scott.