Ext checkboxGroup 全选

   var myCheckbox = new Ext.form.CheckboxGroup({
        id:'myGroup',
        xtype: 'checkboxgroup',
        fieldLabel: 'Single Column',
        // 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',id: 'Item 3'}
        ]
    });
    
    var button = new Ext.Button({
        text: '全选/全不选'
        ,handler: function(){
            var length = myCheckbox.items.getCount();
            var all = new Array();
            for (i = 0;i<length;i++){
                all[i]=true;
            }
        myCheckbox.setValue(all);
        }
    });

    form.add(myCheckbox);
    form.add(button);

你可能感兴趣的:(Ext checkboxGroup 全选)