标记批量删除按钮
/atcrowdfunding-admin-1-webui/src/main/webapp/WEB-INF/role-page.jsp中:
<button type="button" class="btn btn-danger"
style="float: right; margin-left: 10px;">
<i class=" glyphicon glyphicon-remove"></i> 删除
</button>
变成
<button id="batchRemoveBtn" type="button" class="btn btn-danger"
style="float: right; margin-left: 10px;">
<i class=" glyphicon glyphicon-remove"></i> 批量删除
</button>
检查itemBox是否被选中
/atcrowdfunding-admin-1-webui/src/main/webapp/WEB-INF/role-page.jsp
// 给批量删除按钮绑定单击响应函数
$("#batchRemoveBtn").click(function(){
// 获取被选中的itemBox数组长度
var length = $(".itemBox:checked").length;
// 如果长度为0,说明没有选择itemBox
if(length == 0) {
layer.msg("请至少选择一条!");
return ;
}
// 未完待续...
});
在弹出的模态框中显示confirm信息
// 给批量删除按钮绑定单击响应函数
$("#batchRemoveBtn").click(function(){
// 获取被选中的itemBox数组长度
var length = $(".itemBox:checked").length;
// 如果长度为0,说明没有选择itemBox
if(length == 0) {
layer.msg("请至少选择一条!");
return ;
}
// 在全局作用域内创建roleIdArray
window.roleIdArray = new Array();
// 遍历$(".itemBox:checked")
$(".itemBox:checked").each(function(){
// 通过checkbox的roleid属性获取roleId值
var roleId = $(this).attr("roleid");
// 存入数组
window.roleIdArray.push(roleId);
});
// 调用函数打开模态框
showRemoveConfirmModal();
});