layui表格批量删除数据
$("#alldel").on('click',function () {
var checkStatus = table.checkStatus('execution');
if(checkStatus.data.length==0){
parent.layer.msg('请先选择要删除的数据行!', {icon: 2});
return ;
}
var ids = "";
if(checkStatus.data.length<2){
ids += checkStatus.data[i].recordId
}else{
for(var i=0;i<checkStatus.data.length;i++){
ids += checkStatus.data[i].recordId+",";
}
}
parent.layer.msg('删除中...', {icon: 16,shade: 0.3,time:5000});
$.ajax({
url:根据自己的情况写地址,
type: 'DELETE',
success: function (res) {
if(res.code==200){
layer.msg('删除成功!', {icon: 1,time:2000,shade:0.2});
table.reload('表格的id属性');
}else{
layer.msg('删除失败!', {icon: 2,time:3000,shade:0.2});
}
}
})
})