Bootstrap

datatable的全选和单个复选框

<table id="device-all-table" class="m-table t-striped table-hide">
																<thead>
																	<tr>
																		<th class="" style="width: 5%;">
																		    <label for="checkbox30" class="m-checkbox widthAu f-ib ">
																		        <input type="checkbox" name="box" class="weui-check weui " id="checkbox30">
																		        <i class="weui-icon-checked"></i>
																		    </label>
																		</th>
																		<th class="txt-hide" title="计算机名" style="width: 20%;">计算机名</th>
																	</tr>
																</thead>
																<tbody>
																	<tr>
																		<td></td>
																		<td class="">
																		    <label for="checkbox31" class="m-checkbox widthAu f-ib ">
																		        <input type="checkbox" name="box" class="weui-check " id="checkbox31">
																		        <i class="weui-icon-checked"></i>
																		    </label>
																		</td>
																		<td>
																			 <a data-href="mnt-treeNode5.html"> WIN-7NBP3CTR1UM</a>
																		</td>
																	</tr>
																</tbody>
															</table>
//全选
	$(".weui").click(function () {
		   
	    if (this.checked) {
	    $(this).attr('checked', 'checked')
	    $("input[name='box']").each(function () {
	    this.checked = true;
	       if($(this).attr("id")!="checkbox30"){
			console.log($(this).attr("id"));
			}
	  });
	
	} else {
	    $(this).removeAttr('checked')
	    $("input[name='box']").each(function () {
	    this.checked = false;
	    });
	  }
	});
	//单个
	$("input[name='box']").click(function () {
	  if ($(this).is(":checked") == false) {
	    $(".weui").prop("checked", false);
	  } else {
	    var flag = true;
	    $(".weui").prop("checked", true);
	    $("input[name='box']").each(function () {
	    if (this.checked == false) {
	      $(".weui").prop("checked", false);
	      flag = false;
	      return;
	    }
	      if($(this).attr("id")!="checkbox30"){
	      			console.log($(this).attr("id"));
	      	}
	  });
	}
	});
;