当前位置: 代码迷 >> Web前端 >> Ext中 对checkbo 动态的打钩, 设立checked
  详细解决方案

Ext中 对checkbo 动态的打钩, 设立checked

热度:95   发布时间:2012-09-18 16:21:42.0
Ext中 对checkbo 动态的打钩, 设置checked

一个radiogroup:

this.relationCheckBox = new Ext.form.RadioGroup({
		fieldLabel: '关系',
		id: 'condition_relation',
		defaultType: 'checkbox',
		vertical: true,
		width: 200,
		columns: 3,
		items:[{
			id: 'relation_g',
			boxLabel: '>',
			inputValue: '1',
			listeners: {
				check: function(field){
					if(field.checked == true){
						Ext.getCmp('relation_l').disable();
					}else{
						Ext.getCmp('relation_l').enable();
					}
				}
			}
		}
		,{
			id: 'relation_e',
			boxLabel: '=',
			inputValue: '0'
		}
		,{
			id: 'relation_l',
			boxLabel: '<',
			inputValue: '2',
			listeners: {
				check: function(field){
					if(field.checked == true){
						Ext.getCmp('relation_g').disable();
					}else{
						Ext.getCmp('relation_g').enable();
					}
				}
			}
		}]
	});

?相对其中的checkbox进行动态设置,使其选中

但是 通过 遍历如

maker.relationCheckBox.items.each(function(item){
				item.checked = true;
			});

没起作用,只有使用setValue,才可以

?

maker.relationCheckBox.items.each(function(item){//设置关系多选
				
					item.setValue(true);
				
			});
?这样checkbox就会被选中
  相关解决方案