3 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
4 <title>The source code</title>
5 <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
6 <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
8 <body onload="prettyPrint();">
9 <pre class="prettyprint lang-js">/*!
10 * Ext JS Library 3.3.0
11 * Copyright(c) 2006-2010 Ext JS, Inc.
13 * http://www.extjs.com/license
15 <div id="cls-Ext.form.RadioGroup"></div>/**
16 * @class Ext.form.RadioGroup
17 * @extends Ext.form.CheckboxGroup
18 * A grouping container for {@link Ext.form.Radio} controls.
20 * Creates a new RadioGroup
21 * @param {Object} config Configuration options
24 Ext.form.RadioGroup = Ext.extend(Ext.form.CheckboxGroup, {
25 <div id="cfg-Ext.form.RadioGroup-items"></div>/**
26 * @cfg {Array} items An Array of {@link Ext.form.Radio Radio}s or Radio config objects
27 * to arrange in the group.
29 <div id="cfg-Ext.form.RadioGroup-allowBlank"></div>/**
30 * @cfg {Boolean} allowBlank True to allow every item in the group to be blank (defaults to true).
31 * If allowBlank = false and no items are selected at validation time, {@link @blankText} will
32 * be used as the error text.
35 <div id="cfg-Ext.form.RadioGroup-blankText"></div>/**
36 * @cfg {String} blankText Error text to display if the {@link #allowBlank} validation fails
37 * (defaults to 'You must select one item in this group')
39 blankText : 'You must select one item in this group',
42 defaultType : 'radio',
45 groupCls : 'x-form-radio-group',
47 <div id="event-Ext.form.RadioGroup-change"></div>/**
49 * Fires when the state of a child radio changes.
50 * @param {Ext.form.RadioGroup} this
51 * @param {Ext.form.Radio} checked The checked radio
54 <div id="method-Ext.form.RadioGroup-getValue"></div>/**
55 * Gets the selected {@link Ext.form.Radio} in the group, if it exists.
56 * @return {Ext.form.Radio} The selected radio.
58 getValue : function(){
60 this.eachItem(function(item){
69 <div id="method-Ext.form.RadioGroup-onSetValue"></div>/**
70 * Sets the checked radio in the group.
71 * @param {String/Ext.form.Radio} id The radio to check.
72 * @param {Boolean} value The value to set the radio.
73 * @return {Ext.form.RadioGroup} this
75 onSetValue : function(id, value){
76 if(arguments.length > 1){
77 var f = this.getBox(id);
81 this.eachItem(function(item){
89 this.setValueForItem(id);
93 setValueForItem : function(val){
94 val = String(val).split(',')[0];
95 this.eachItem(function(item){
96 item.setValue(val == item.inputValue);
101 fireChecked : function(){
103 this.checkTask = new Ext.util.DelayedTask(this.bufferChecked, this);
105 this.checkTask.delay(10);
109 bufferChecked : function(){
111 this.eachItem(function(item){
117 this.fireEvent('change', this, out);
120 onDestroy : function(){
122 this.checkTask.cancel();
123 this.checkTask = null;
125 Ext.form.RadioGroup.superclass.onDestroy.call(this);
130 Ext.reg('radiogroup', Ext.form.RadioGroup);