全选 批量删除
来源:互联网 发布:手机网络被劫持怎么办 编辑:程序博客网 时间:2024/06/10 22:48
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>全选、批量删除</title>
<script src="js/angular.min.js"></script>
<script>
angular.module("myapp", []).controller("kongzhiqi", function($scope) {
$scope.users = [
{state:false,name: "洋葱",price: 2,num: 2},
{state:false,name: "大葱",price: 4,num: 12},
{state:false,name: "胡萝卜",price: 1,num: 2},
{state:false,name: "牛肉",price: 50,num: 12},
{state:false,name: "胡萝卜1",price: 1,num: 2},
{state:false,name: "牛肉1",price: 50,num: 12}
];
$scope.del=function(){
for(var i=0;i<$scope.users.length;i++){
if($scope.users[i].state){
$scope.users.splice(i,1);
i--; //让下个值从删除的索引开始
}
}
}
//全选的操作
$scope.ckAll=function(){
for(var i in $scope.users){
$scope.users[i].state=$scope.ckall;
}
}
})
</script>
</head>
<body ng-app="myapp" ng-controller="kongzhiqi">
<button ng-click="del()">批量删除</button>
<table border="1px" width="500px">
<tr>
<th>
<input type="checkbox" ng-model="ckall" ng-click="ckAll()" /> 全选/全不选
</th>
<th>商品名称 </th>
<th>商品价格</th>
<th>商品数量</th>
</tr>
<tr ng-repeat="u in users|filter:{name:selname,num:selnum}|orderBy: ord:isjia">
<!-- 获取值 -->
<td><input type="checkbox" ng-model="u.state" /> </td>
<td>{{u.name}}</td>
<td>{{u.price}}</td>
<td>{{u.num}}</td>
</tr>
</table>
</body>
</html>
<html>
<head>
<meta charset="UTF-8">
<title>全选、批量删除</title>
<script src="js/angular.min.js"></script>
<script>
angular.module("myapp", []).controller("kongzhiqi", function($scope) {
$scope.users = [
{state:false,name: "洋葱",price: 2,num: 2},
{state:false,name: "大葱",price: 4,num: 12},
{state:false,name: "胡萝卜",price: 1,num: 2},
{state:false,name: "牛肉",price: 50,num: 12},
{state:false,name: "胡萝卜1",price: 1,num: 2},
{state:false,name: "牛肉1",price: 50,num: 12}
];
$scope.del=function(){
for(var i=0;i<$scope.users.length;i++){
if($scope.users[i].state){
$scope.users.splice(i,1);
i--; //让下个值从删除的索引开始
}
}
}
//全选的操作
$scope.ckAll=function(){
for(var i in $scope.users){
$scope.users[i].state=$scope.ckall;
}
}
})
</script>
</head>
<body ng-app="myapp" ng-controller="kongzhiqi">
<button ng-click="del()">批量删除</button>
<table border="1px" width="500px">
<tr>
<th>
<input type="checkbox" ng-model="ckall" ng-click="ckAll()" /> 全选/全不选
</th>
<th>商品名称 </th>
<th>商品价格</th>
<th>商品数量</th>
</tr>
<tr ng-repeat="u in users|filter:{name:selname,num:selnum}|orderBy: ord:isjia">
<!-- 获取值 -->
<td><input type="checkbox" ng-model="u.state" /> </td>
<td>{{u.name}}</td>
<td>{{u.price}}</td>
<td>{{u.num}}</td>
</tr>
</table>
</body>
</html>
阅读全文
0 0
- 全选与批量删除
- angularJS全选/批量删除
- 全选|全不选,批量删除
- 全选 批量删除
- 全选全不选批量删除
- 删除 添加 全选 批量删除
- GridView全选和批量删除
- js 全选、取消、批量删除
- js全选+ajax批量删除
- 全选,反选,批量删除
- 全选、反选、批量删除
- 批量删除 全选 反选
- 全选批量删除 添加 查询
- jeesite全选 批量删除。有坑啊!
- jQuery全选全不选 批量删除
- Angular全选及批量删除
- qisan__lianxi2查询排序全选删除批量删除
- 批量删除+单个删除+全选反选
- 树- 森林的带度数层次存储
- 红茶一杯话Binder 五(传输机制篇_下)
- Python+Tensorflow的cnn技术识别验证码
- java加密与解密艺术阅读摘要(一)
- 快递小哥“挂电话”,机智的程序员们想到的解决办法是……
- 全选 批量删除
- Java面向对象的三大特征:
- 实现搜索页面到商品列表
- 增删排序
- Unity3D——RectTransform详解
- Hibernate 映射关系
- 关于指针和数组的关系,一点小小的总结
- LSTM 牛津大学机器学习课程
- Java练习题25 TCP协议