/** 此Demo演示了如何创建一个单选的按钮,并添加一个状态改变事件 @author Ray */ Ext.onReady(function(){ //创建一个RadioGroup var radio = new Ext.form.RadioGroup({ id:'myGroup', fieldLabel: 'Single Column', itemCls: 'x-check-group-alt', columns: 1, //此三项为三个单选按钮 /** boxLabel 显示出来的名字 name 表示解析成HTML页面元素后name属性 比如 :<input id="ext-comp-1006" class="x-form-radio x-form-field" type="radio" name="cb" autocomplete="off" value="3" checked=""/> inputValue 表示选中的按钮的值 */ items: [ {boxLabel: 'Item 1', name: 'cb',inputValue : '1'}, {boxLabel: 'Item 2', name: 'cb',inputValue : '2'}, {boxLabel: 'Item 3', name: 'cb',inputValue : '3'} ] }); //为单选按钮添加一个选中的事件 /** @param rg 包含单选按钮的单选组 @param radio 选中的按钮 */ radio.on('change',function(rg,radio){ alert(radio.inputValue); }); //放置单选按钮的表单,单选按钮只能放在表单中显示 var panel =new Ext.form.FormPanel({ items : [radio], title : 'form', layout : 'fit' }); //解析到页面ID为tree-div的div panel.applyToMarkup('tree-div'); }); PS 如有错误请大家抛砖指教!!