Reputation: 25564
how I can automaticly pickup a name from radiogroup and pass it to radio element:
xtype: 'radiogroup', fieldLabel: 'Is Sale scheduled', name: 'SaleScheduled', items: [ { boxLabel: 'Yes', name: 'SaleScheduled', inputValue: 'YES' }, { boxLabel: 'No', name: 'SaleScheduled', inputValue: 'NO' } ], ....
I tryed to use name: this.getName() or this.findParentByType ('radiogroup') I try to created extended radiogroup element that will have to chooses Yes or No and I can have it defined as xtype
Upvotes: 0
Views: 1297
Reputation: 8376
If I understand you right, you're looking for a YesNoRadioGroup
which passes its name onto its child elements:
Ext.ns('Ext.ux');
Ext.ux.YesNoGroup = Ext.extend(Ext.form.RadioGroup, {
constructor: function(cfg) {
cfg = cfg || {};
cfg.items = [
{ boxLabel: 'Yes', name: cfg.name, inputValue: 'YES' },
{ boxLabel: 'No', name: cfg.name, inputValue: 'NO' }
];
Ext.ux.YesNoGroup.superclass.constructor.call(this, cfg);
}
});
Ext.reg('yes-no-group', Ext.ux.YesNoGroup);
Alternatively you could do the same as above but add an addItem
function which does similar work if you want more flexibility.
Upvotes: 1