对Extjs中的CheckBoxGroup的认识

var myCheckboxGroup = new Ext.form.CheckboxGroup({
    id:'myGroup',
    xtype: 'checkboxgroup',
    fieldLabel: 'Single Column',
    itemCls: 'x-check-group-alt',
    // Put all controls in a single column with width 100%
    columns: 1,
    items: [
        {boxLabel: 'Item 1', name: 'cb-col-1'},
        {boxLabel: 'Item 2', name: 'cb-col-2', checked: true},
        {boxLabel: 'Item 3', name: 'cb-col-3'}
    ]
});

myCheckboxGoup是一个Checkbox组件的集合,对每一个Checkbox项的访问,可能过
myCheckboxGroup.items.get(i) 定位到Checkbox 然后查看属性值 例如 myCheckboxGroup.items.get(i).inputValue


如果这种方法没有效果
  可以尝试用这样的方法
myCheckboxGroup.setValue('cb-col-1', true);//设置 name为cb-col-1 的checked为true 即表选中

你可能感兴趣的:(ext)