3 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
\r
4 <title>The source code</title>
\r
5 <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
\r
6 <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
\r
8 <body onload="prettyPrint();">
\r
9 <pre class="prettyprint lang-js"><div id="cls-Ext.form.RadioGroup"></div>/**
10 * @class Ext.form.RadioGroup
11 * @extends Ext.form.CheckboxGroup
12 * A grouping container for {@link Ext.form.Radio} controls.
14 * Creates a new RadioGroup
15 * @param {Object} config Configuration options
18 Ext.form.RadioGroup = Ext.extend(Ext.form.CheckboxGroup, {
19 <div id="cfg-Ext.form.RadioGroup-items"></div>/**
20 * @cfg {Array} items An Array of {@link Ext.form.Radio Radio}s or Radio config objects
21 * to arrange in the group.
23 <div id="cfg-Ext.form.RadioGroup-allowBlank"></div>/**
24 * @cfg {Boolean} allowBlank True to allow every item in the group to be blank (defaults to true).
25 * If allowBlank = false and no items are selected at validation time, {@link @blankText} will
26 * be used as the error text.
29 <div id="cfg-Ext.form.RadioGroup-blankText"></div>/**
30 * @cfg {String} blankText Error text to display if the {@link #allowBlank} validation fails
31 * (defaults to 'You must select one item in this group')
33 blankText : 'You must select one item in this group',
36 defaultType : 'radio',
39 groupCls : 'x-form-radio-group',
41 <div id="event-Ext.form.RadioGroup-change"></div>/**
43 * Fires when the state of a child radio changes.
44 * @param {Ext.form.RadioGroup} this
45 * @param {Ext.form.Radio} checked The checked radio
48 <div id="method-Ext.form.RadioGroup-getValue"></div>/**
49 * Gets the selected {@link Ext.form.Radio} in the group, if it exists.
50 * @return {Ext.form.Radio} The selected radio.
52 getValue : function(){
54 this.eachItem(function(item){
63 <div id="method-Ext.form.RadioGroup-onSetValue"></div>/**
64 * Sets the checked radio in the group.
65 * @param {String/Ext.form.Radio} id The radio to check.
66 * @param {Boolean} value The value to set the radio.
67 * @return {Ext.form.RadioGroup} this
69 onSetValue : function(id, value){
70 if(arguments.length > 1){
71 var f = this.getBox(id);
75 this.eachItem(function(item){
83 this.setValueForItem(id);
87 setValueForItem : function(val){
88 val = String(val).split(',')[0];
89 this.eachItem(function(item){
90 item.setValue(val == item.inputValue);
95 fireChecked : function(){
97 this.checkTask = new Ext.util.DelayedTask(this.bufferChecked, this);
99 this.checkTask.delay(10);
103 bufferChecked : function(){
105 this.eachItem(function(item){
111 this.fireEvent('change', this, out);
114 onDestroy : function(){
116 this.checkTask.cancel();
117 this.checkTask = null;
119 Ext.form.RadioGroup.superclass.onDestroy.call(this);
124 Ext.reg('radiogroup', Ext.form.RadioGroup);