Ext 中的checkGroup实现的全选与反选功能

function getCheckAll(e){
        var myCheckboxGroup=Ext.getCmp('mycheckGroup');
        if(e.checked){
            var length = myCheckboxGroup.items.getCount();
            var all = new Array();
            for (i = 0;i<length;i++){
                all[i]=true;
            }
            myCheckboxGroup.setValue(all);
        }else{
            var length = myCheckboxGroup.items.getCount();
            var all = new Array();
            for (i = 0;i<length;i++){
                all[i]=false;
            }
            myCheckboxGroup.setValue(all);
        }
    }
    function getCheckOther(e){
        var myCheckboxGroup=Ext.getCmp('mycheckGroup');
        var all = new Array();
        var length = myCheckboxGroup.items.getCount();
        for (var i = 0; i < length; i++){
           var item= myCheckboxGroup.items.itemAt(i);
           if (item.checked){   
              all[i]=false;                
           }else{
              all[i]=true;
           }   
        }   
        myCheckboxGroup.setValue(all);
    }


你可能感兴趣的:(ext,checkGroup)