在项目中,经常遇到,于是整理
引用bootstrap的js和css
代码解释:
$("#dgFlowList").find(":checkbox:checked").each(function(){
var val = $(this).parents("tr").text(); data.push(val); });
代码:
1 2 3多选 4 5 6 7 8 9 40 41 42 43
流程名称 | 表单名称 | 操作 | 47|
---|---|---|---|
50 | 请假单1 | 51请假单 | 5253 删除54 | 55
58 | 请假单2 | 59请假单 | 6061 删除62 | 63
66 | 请假单3 | 67请假单 | 6869 删除70 | 71
74 | 请假单4 | 75请假单 | 7677 删除78 | 79
82 | 请假单5 | 83请假单 | 8485 删除86 | 87
90 91
92 93 app.js代码,是为notify写的,于功能没有多大的关系
1 /** 2 * Notify Addon definition as jQuery plugin 3 * Adapted version to work with Bootstrap classes 4 * More information http://getuikit.com/docs/addons_notify.html 5 */ 6 7 (function ($, window, document) { 8 9 var containers = {}, 10 messages = {}, 11 12 notify = function (options) { 13 14 if ($.type(options) == 'string') { 15 options = {message: options}; 16 } 17 18 if (arguments[1]) { 19 options = $.extend(options, $.type(arguments[1]) == 'string' ? {status: arguments[1]} : arguments[1]); 20 } 21 22 return (new Message(options)).show(); 23 }, 24 closeAll = function (group, instantly) { 25 if (group) { 26 for (var id in messages) { 27 if (group === messages[id].group) messages[id].close(instantly); 28 } 29 } else { 30 for (var id in messages) { 31 messages[id].close(instantly); 32 } 33 } 34 }; 35 36 var Message = function (options) { 37 38 var $this = this; 39 40 this.options = $.extend({}, Message.defaults, options); 41 42 this.uuid = "ID" + (new Date().getTime()) + "RAND" + (Math.ceil(Math.random() * 100000)); 43 this.element = $([ 44 // alert-dismissable enables bs close icon 45 '' 49 50 ].join('')).data("notifyMessage", this); 51 52 // status 53 if (this.options.status) { 54 this.element.addClass('alert alert-' + this.options.status); 55 this.currentstatus = this.options.status; 56 } 57 58 this.group = this.options.group; 59 60 messages[this.uuid] = this; 61 62 if (!containers[this.options.pos]) { 63 containers[this.options.pos] = $(' ').appendTo('body').on("click", ".uk-notify-message", function () { 64 $(this).data("notifyMessage").close(); 65 }); 66 } 67 }; 68 69 70 $.extend(Message.prototype, { 71 72 uuid: false, 73 element: false, 74 timout: false, 75 currentstatus: "", 76 group: false, 77 78 show: function () { 79 80 if (this.element.is(":visible")) return; 81 82 var $this = this; 83 84 containers[this.options.pos].show().prepend(this.element); 85 86 var marginbottom = parseInt(this.element.css("margin-bottom"), 10); 87 88 this.element.css({ 89 "opacity": 0, 90 "margin-top": -1 * this.element.outerHeight(), 91 "margin-bottom": 0 92 }).animate({"opacity": 1, "margin-top": 0, "margin-bottom": marginbottom}, function () { 93 94 if ($this.options.timeout) { 95 96 var closefn = function () { 97 $this.close(); 98 }; 99 100 $this.timeout = setTimeout(closefn, $this.options.timeout);101 102 $this.element.hover(103 function () {104 clearTimeout($this.timeout);105 },106 function () {107 $this.timeout = setTimeout(closefn, $this.options.timeout);108 }109 );110 }111 112 });113 114 return this;115 },116 117 close: function (instantly) {118 119 var $this = this,120 finalize = function () {121 $this.element.remove();122 123 if (!containers[$this.options.pos].children().length) {124 containers[$this.options.pos].hide();125 }126 127 delete messages[$this.uuid];128 };129 130 if (this.timeout) clearTimeout(this.timeout);131 132 if (instantly) {133 finalize();134 } else {135 this.element.animate({136 "opacity": 0,137 "margin-top": -1 * this.element.outerHeight(),138 "margin-bottom": 0139 }, function () {140 finalize();141 });142 }143 },144 145 content: function (html) {146 147 var container = this.element.find(">div");148 149 if (!html) {150 return container.html();151 }152 153 container.html(html);154 155 return this;156 },157 158 status: function (status) {159 160 if (!status) {161 return this.currentstatus;162 }163 164 this.element.removeClass('alert alert-' + this.currentstatus).addClass('alert alert-' + status);165 166 this.currentstatus = status;167 168 return this;169 }170 });171 172 Message.defaults = {173 message: "",174 status: "normal",175 timeout: 5000,176 group: null,177 pos: 'top-center'178 };179 180 181 $["notify"] = notify;182 $["notify"].message = Message;183 $["notify"].closeAll = closeAll;184 185 return notify;186 187 }(jQuery, window, document));