时间:2021-07-01 10:21:17 帮助过:16人阅读
获得选择的数据
//批量删除 function deleteUserList() { //获取所有被选中的记录 var rows = $("#user").bootstrapTable('getSelections'); if (rows.length== 0) { alert("请先选择要删除的记录!"); return; } var ids = ''; for (var i = 0; i < rows.length; i++) { ids += rows[i]['id'] + ","; } ids = ids.substring(0, ids.length - 1); deleteUser(ids); }
//单个删除 function deleteUserById(id) { deleteUser(id); }
//删除 function deleteUser(ids) { var msg = "您真的确定要删除吗?"; if (confirm(msg) == true) { $.ajax({ url: "${path}/user/deleteUserList.do", type: "post", data: { ids: ids }, success: function (data) { alert(data.msg); //重新加载记录 //重新加载数据 $("#user").bootstrapTable('refresh', {url: '/user/getUserList.do'}); } }); } }
public long deleteUserList(String ids) { String[] ss = ids.split(","); long count= 0; for (Strings : ss) { userResourceExtend.deleteUser(Integer.parseInt(s)); count++; } return count; }
【相关视频推荐:Bootstrap教程】
以上就是bootstrap实现删除和批量删除操作的详细内容,更多请关注Gxl网其它相关文章!