js react 全选和反选

onCheckAll = (data) => {
		var CheckBox  = document.getElementsByName(data);
		for(let i=0;i<CheckBox.length;i++){
            if(CheckBox[i].checked==true){
                     CheckBox[i].checked=false;
            } else{
                 CheckBox[i].checked=true
            }
        };
	}



const columnWBS = [
			{title:'WBS节点名称',dataIndex:'label'},
			{title:'权限',dataIndex:'qx',
			render: (text, record, index) =>(
		      	<span >
			      	<Button size="small" onClick={this.onCheckAll.bind(this,record.key)} style={{marginRight:'5px'}}> 全选</Button>
			      	<span id="checkBoxWrap">
				      	<input type="checkbox"  name={record.key} style={{marginLeft:'5px'}}/> 添加
				      	<input type="checkbox"  name={record.key} style={{marginLeft:'5px'}}/> 删除
				      	<input type="checkbox"  name={record.key} style={{marginLeft:'5px'}}/> 编辑
				      	<input type="checkbox"  name={record.key} style={{marginLeft:'5px'}}/> 查看
				    </span>
		      	</span>
			
			)}]

  

posted @ 2017-07-03 09:25  年少的你如此美丽  阅读(274)  评论(0编辑  收藏  举报