Extjs RadioBox 单选

// 两个radio 只是显示,两个具有互斥性,触发事件时给一个隐藏字段赋值,后台读取隐藏字段,肯定不是最优,望高手拍砖

this.cntRadio = new Ext.form.Radio({
        id: 'cntRadioId',
        boxLabel: '数量',
        inputValue: 'cnt',
        listeners: {
            'check': function() {
                //alert(this.getValue());
                if (this.getValue()) {
                    Ext.getCmp('moneyRadioId').setValue(false);
                    this.setValue(true);
                    Ext.getCmp('aresultType').setValue('cnt');
                }
            }
        }
});
 this.moneyRadio = new Ext.form.Radio({
        id: 'moneyRadioId',
        boxLabel: '总投资',
        inputValue: 'money',
        listeners: {
            'check': function() {
                if (this.getValue()) {
                    Ext.getCmp('cntRadioId').setValue(false);
                    this.setValue(true);
                    Ext.getCmp('aresultType').setValue('totalMoney');
                }
            }
        }
});

 this.formPanel = new Ext.form.FormPanel({
      baseCls: 'x-plain',
      frame: false,
      id: id,
      bodyStyle: 'padding:5px 12px',
      url: 'Station.aspx?ac=Analysis',
      items: [{
                xtype: 'hidden',
                id: 'agroupType',
                value: 'country'
            }, {
                xtype: 'radiogroup',
                fieldLabel: '统计结果',
                id: 'resultRadio',
                items: [
                    this.cntRadio, this.moneyRadio
                ]
          }]

});

posted @ 2012-09-05 17:10  oftenlin  阅读(1961)  评论(0编辑  收藏  举报