<a class="btn size-MINI btn-danger radius" href="javascript:void(0);" id="batchDeleteData"><i class="Hui-iconfont"></i> 批量删除</a>
<th width="20"><input type="checkbox" name="" value="" id="topbox"></th>
{
data: "id",
render: function (data, type, full, meta) {
return '<input type="checkbox" class="checkchild" value="' + data + '" />';
},
bSortable: false
}
/* 全选*/
$('#topbox').change(function () {
if ($('#topbox').is(':checked')) {
$("#table1 [type='checkbox']").prop("checked","checked");
} else {
$("#table1 [type='checkbox']").prop("checked","");
}
});
//批量删除数据信息
$("#batchDeleteData").click(function () {
var ckValues = [];
$("#table1 [type='checkbox']:checked").each(function () {
if ($(this).val())
ckValues.push($(this).val());
});
if (ckValues.length <=0) {
alert("请先选择数据");
return;
}
layer.confirm('确认要删除吗?',function(index){
$.ajax({
type: 'post',
url: '/plan/deletePlan?user=' + userInfo.employeeId,
dataType: 'json',
data:{
ids:ckValues
},
success: function(data){
location.replace(location.href);
layer.msg('已删除!',{icon:1,time:1000});
},
error:function(data) {
if (data.responseText) {
var error = $.parseJSON(data.responseText);
alert(error.message);
}
}
});
});
});