Extjs radioGroup 取选中的值 设置值选中

来源:互联网 发布:js给input value赋值 编辑:程序博客网 时间:2024/05/22 08:28

定义 radiogroup

var radiogroup= new Ext.form.RadioGroup({ fieldLabel : "性别",items : [           { boxLabel : '男', inputValue : '1', checked : true, name : "radSex" },          { boxLabel : '女, name : "radSex", inputValue : '2' }        ]});
重写getValue 和setValue
Ext.override(Ext.form.RadioGroup, {   getValue: function() {       var v;       this.items.each(function(item) {         if ( item.getValue() ) {            v = item.getRawValue();            return false;         }       });      return v;    },    setValue: function(v) {         if(this.rendered)            this.items.each(function(item) {                item.setValue(item.getRawValue() == v);            });         else           for(k in this.items) this.items[k].checked = this.items[k].inputValue == v;    } }); 

获取radiogroup值还可以   radiogroup.getValue().type 获取


原创粉丝点击