bootstrapTable--4.删除和批量删除
http://blog.csdn.net/qq_26553781/article/details/78058389
-----------------------------------------------------------------------------------
//删除-单条
function dele(id) {
layer.confirm('您确认删除选中记录?', {
btn : [ '删除' ]
//按钮
}, function() {
deleteDeployById(id);
});
}
//批量删除
$('#remove').click(function() {
deleteDeploy();
});
function deleteDeploy() {
var rows = $('#cusTable').bootstrapTable('getSelections');
var ids="";
for(var i=0;i<rows.length;i++){
ids+=rows[i]['id']+",";
}
ids=ids.substring(0,ids.length-1);
alert(ids+"-----ids-------");
if (rows.length > 0) {
layer.confirm('您确认删除选中记录?', {
btn : [ '删除' ]
//按钮
}, function(){
deleteDeployById(ids);
});
} else {
layer.msg("请选择删除项", {
icon : 2
});
return;
}
}
//执行删除操作
function deleteDeployById(ids) {
$.ajax({
url : 'deleteUserDeploy.json',
data:'ids=' + ids,
type : 'post',
success : function(data, textStatus, jqXHR) {
layer.msg('删除成功', {
icon : 1
});
$('#cusTable').bootstrapTable('refresh');
},
error : function(jqXHR, textStatus, errorThrown) {
layer.msg(textStatus, {
icon : 2
});
}
});
}
posted on 2018-01-02 16:03 Steven5007 阅读(613) 评论(0) 编辑 收藏 举报