1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > Angularjs+bootstrap+table多选(全选)支持单击行选中实现编辑 删除功能的代码案例

Angularjs+bootstrap+table多选(全选)支持单击行选中实现编辑 删除功能的代码案例

时间:2018-09-04 18:44:56

相关推荐

Angularjs+bootstrap+table多选(全选)支持单击行选中实现编辑 删除功能的代码案例

web前端|js教程

angularjs bootstrap table

web前端-js教程最终实现效果:

asp 商城源码下载,vscode如何编程图片,ubuntu 跳板机,tomcat7 .xml,sqlite存储大量数据库,金融学实证分析爬虫关键词,php匹配中文字符,杭州短视频seo公司,asp网站后台管理系统教程,医院管理系统模板lzw

998棋牌源码,键盘命令安装ubuntu,淘宝快递单号爬虫,php behavior,seo运用详解lzw

index.html

金蟾捕鱼手游源码,vscode适合做开发吗,ubuntu api录音,读取tomcat日志命令,反爬虫北京,php输出宏,东莞市纯手工seo报价lzw

已选数量:{{count}}

已选对象:{{selectData}}

script.js

// Code goes herevar routerApp = angular.module( outerApp, [ gAnimate, gSanitize, ui.bootstrap]);routerApp.controller(zdTable, [ $scope, function(scope) {console.log(controller);//初始化数据scope.datas = [ {name:admin1, rem:备注}, { name:admin2, rem:备注}, { name:admin3, rem:备注} ];scope.count = 0;//已选择数量 scope.selectData = [];//已选对象//选择单个(取消选择单个scope.changeCurrent = function(current, $event) { //计算已选数量 true加, false减 scope.count += current.checked ? 1 : -1; //判断是否全选,选数量等于数据长度为true scope.selectAll = scope.count === scope.datas.length; //统计已选对象 scope.selectData = []; angular.forEach(scope.datas, function(item) {if(item.checked){ scope.selectData[scope.selectData.length] = item;} }); $event.stopPropagation();//阻止冒泡};//单击行选中scope.changeCurrents = function(current, $event) { if(current.checked == undefined){current.checked = true; }else{current.checked = !current.checked; } scope.changeCurrent(current, $event);}; //全选(取消全选scope.changeAll = function() { //console.log(scope.selectAll); angular.forEach(scope.datas, function(item) {item.checked = scope.selectAll; }); scope.count = scope.selectAll ? scope.datas.length : 0; if (scope.selectAll) {scope.selectData = scope.datas; } else {scope.selectData = []; }};//编辑事件scope.zdTableEdit = function(item, $event){ console.log(item); $event.stopPropagation();//阻止冒泡};//删除事件scope.zdTableRemove = function(item, $event){ console.log(item); $event.stopPropagation();//阻止冒泡}; } ]);//去掉不需要显示的字段 routerApp.filter(filterTable, function() { return function(obj) { var newObj = {}; for ( var i in obj) {var property = obj[i];if(i != checked){ newObj[i] = property;} } //console.log(newObj); return newObj; };});

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。