angular js 全选/消除全选 和 layer删除确认框
来源:互联网 发布:php文件怎么用打开手机 编辑:程序博客网 时间:2024/06/05 19:42
js: // 全选/取消全选 $scope.selectAll = function(object) { for (var i = 0; i < $scope.listLiveRoom.length; i++) { $scope.listLiveRoom[i].ISCHECK = !$scope.selAll; } }; // checkbox状态改变 $scope.chkChange = function() { var j = 0; for (var i = 0; i < $scope.listLiveRoom.length; i++) { if (!$scope.listLiveRoom[i].ISCHECK) { $scope.selAll = false; } if ($scope.listLiveRoom[i].ISCHECK) { j++; } } if (j == $scope.listLiveRoom.length) { $scope.selAll = true; } };// 删除确认对话框表示 $scope.showConfirm = function() {//TODO // 选中对象确认 var intCount = 0; for (var i = 0; i < $scope.listBackPlayRoom.length; i++) { if ($scope.listBackPlayRoom[i].ISCHECK2 == true) { intCount++; } } if (intCount == 0) { $scope.error = "请选择删除对象。"; return; } var title = "确认"; $scope.confirmContent = '确定要删除吗?'; var mydom = $('#confirmDlg'); layer.open({ type : 1, shadeClose : false, area : [ '450px', '160px' ], title : title, content : mydom, btn : [ '确定', '取消' ], btn1 : function(index, layero) { }, btn2 : function(index) { layer.close(index); }, yes : function(index, layero) { layer.close(index); delObj(); }, success : function(layero, index) { mydom.show(); }, end : function() { mydom.hide(); }, }); }; function delObj() { $scope.error = ""; var idList = ""; // 获取要删除的数据 if ($scope.listBackPlayRoom&& $scope.listBackPlayRoom.length > 0) { for (var i = 0; i < $scope.listBackPlayRoom.length; i++) { if ($scope.listBackPlayRoom[i].ISCHECK2 == true) { if (idList != "") { idList += ",";// 以逗号分隔 } idList += $scope.listBackPlayRoom[i].playbackId; } } } if (idList != "") { $http({ method : "post", url : "find/deleteBackPlayRoom", data : { "idList" : idList } }).success(function(rs, status, headers, config) { chkSession(rs); if (rs.status == 0) { // 更新后数据表示 $scope.inittable(); select(); $scope.success = rs.message; } else { $scope.error = "操作失败。"; } }).error(function(rs, status, headers, config) { $scope.error = "操作时,发生系统异常。"; }); } };
Freemarker:<th><input id="all2" name="check2" type="checkbox" data-ng-model="selAll2" data-ng-click="selectAll2(this)"> </th> <td><input id="special2" type="checkbox" data-ng-model="row.ISCHECK2" data-ng-change="chkChange2()"></td><div id="dialog"> <div id="confirmDlg" style="display: none;"> <div style="margin: 20px;"> <label id="confirmContent"> {{confirmContent}}</label> </div> </div></div>
Controller:// TODO 删除playbackRoompublic void deleteBackPlayRoom() throws ServiceException { Map<String, Object> result = new HashMap<>(); UserBean userBean = getSessionAttr(CommonValue.USER_SESSION_KEY); String playbackRoomIds = getPara("idList"); String[] idArrList = playbackRoomIds.split(","); String updUserId = "maple"; Timestamp ts = new Timestamp(System.currentTimeMillis()); if (userBean != null) { updUserId = userBean.getUpdUsrId(); // updDat = userBean.getUpdDat(); } int total = 0; int success = 0; if (idArrList != null && idArrList.length > 0) { for (int i = 0; i < idArrList.length; i++) { total++; String id = idArrList[i]; if (!StringUtils.isEmpty(id)) { // 删除 TblplaybackroomBo updObj = null; updObj = playbackDao.selectByIdForUpdate(id); updObj.delFlg = 1; updObj.updDat = ts; updObj.updUsrId = updUserId; playbackDao.update(updObj); success++; } else { result.put("status", -1); } } result.put("status", 0); result.put("message", "删除处理结束。成功:" + success + "条,失败:" + (total - success) + "条。"); }
0 0
- angular js 全选/消除全选 和 layer删除确认框
- Angular全选及批量删除
- 用JS完成复选框checkbox的全选\反选\删除确认
- angular js 实现购物车模糊查询删除全选
- js全选删除
- JS实现复选框的全选和批量删除功能
- JS实现复选框的全选和批量删除功能
- js 全选按钮 和 删除代码
- js动态添加表格,全选和删除
- Angular 全选
- 全选、反选及确认删除
- js html复选框的全选和非全选
- 【JS】复选框的全选和取消全选
- angular输入框点击全选
- angular-简单的删除全选demo
- angular全选反选批量删除
- JS的全选和不全选
- 全选复选框和取消所有复选框 jquery全选复选框 js全选复选框
- Apache站点中文乱码解决方案
- 漫谈C++和JAVA
- iOS使用自定义字体
- eclipse 相关
- 安装gitweb
- angular js 全选/消除全选 和 layer删除确认框
- Java迷题:等于,还是不等于?
- 解析AngularJS 表达式
- 香农编码Shannon
- orbslam2的基础理论(一)
- ORA-02436: 日期或系统变量在 CHECK 约束条件中指定错误
- URL中文
- Boosting 和 Gradient Boosting 理解
- C# Maximum request length exceeded. 产生错误的原因,以及解决方法.