夏邑12345_前端

bootstrap-table.min.js 63KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121
  1. /*
  2. * bootstrap-table - v1.11.1 - 2017-02-22
  3. * https://github.com/wenzhixin/bootstrap-table
  4. * Copyright (c) 2017 zhixin wen
  5. * Licensed MIT License
  6. */
  7. ! function(a) {
  8. "use strict";
  9. var b = null,
  10. c = function(a) {
  11. var b = arguments,
  12. c = !0,
  13. d = 1;
  14. return a = a.replace(/%s/g, function() {
  15. var a = b[d++];
  16. return "undefined" == typeof a ? (c = !1, "") : a
  17. }), c ? a : ""
  18. },
  19. d = function(b, c, d, e) {
  20. var f = "";
  21. return a.each(b, function(a, b) {
  22. return b[c] === e ? (f = b[d], !1) : !0
  23. }), f
  24. },
  25. e = function(b, c) {
  26. var d = -1;
  27. return a.each(b, function(a, b) {
  28. return b.field === c ? (d = a, !1) : !0
  29. }), d
  30. },
  31. f = function(b) {
  32. var c, d, e, f = 0,
  33. g = [];
  34. for(c = 0; c < b[0].length; c++) f += b[0][c].colspan || 1;
  35. for(c = 0; c < b.length; c++)
  36. for(g[c] = [], d = 0; f > d; d++) g[c][d] = !1;
  37. for(c = 0; c < b.length; c++)
  38. for(d = 0; d < b[c].length; d++) {
  39. var h = b[c][d],
  40. i = h.rowspan || 1,
  41. j = h.colspan || 1,
  42. k = a.inArray(!1, g[c]);
  43. for(1 === j && (h.fieldIndex = k, "undefined" == typeof h.field && (h.field = k)), e = 0; i > e; e++) g[c + e][k] = !0;
  44. for(e = 0; j > e; e++) g[c][k + e] = !0
  45. }
  46. },
  47. g = function() {
  48. if(null === b) {
  49. var c, d, e = a("<p/>").addClass("fixed-table-scroll-inner"),
  50. f = a("<div/>").addClass("fixed-table-scroll-outer");
  51. f.append(e), a("body").append(f), c = e[0].offsetWidth, f.css("overflow", "scroll"), d = e[0].offsetWidth, c === d && (d = f[0].clientWidth), f.remove(), b = c - d
  52. }
  53. return b
  54. },
  55. h = function(b, d, e, f) {
  56. var g = d;
  57. if("string" == typeof d) {
  58. var h = d.split(".");
  59. h.length > 1 ? (g = window, a.each(h, function(a, b) {
  60. g = g[b]
  61. })) : g = window[d]
  62. }
  63. return "object" == typeof g ? g : "function" == typeof g ? g.apply(b, e || []) : !g && "string" == typeof d && c.apply(this, [d].concat(e)) ? c.apply(this, [d].concat(e)) : f
  64. },
  65. i = function(b, c, d) {
  66. var e = Object.getOwnPropertyNames(b),
  67. f = Object.getOwnPropertyNames(c),
  68. g = "";
  69. if(d && e.length !== f.length) return !1;
  70. for(var h = 0; h < e.length; h++)
  71. if(g = e[h], a.inArray(g, f) > -1 && b[g] !== c[g]) return !1;
  72. return !0
  73. },
  74. j = function(a) {
  75. return "string" == typeof a ? a.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#039;").replace(/`/g, "&#x60;") : a
  76. },
  77. k = function(a) {
  78. for(var b in a) {
  79. var c = b.split(/(?=[A-Z])/).join("-").toLowerCase();
  80. c !== b && (a[c] = a[b], delete a[b])
  81. }
  82. return a
  83. },
  84. l = function(a, b, c) {
  85. var d = a;
  86. if("string" != typeof b || a.hasOwnProperty(b)) return c ? j(a[b]) : a[b];
  87. var e = b.split(".");
  88. for(var f in e) e.hasOwnProperty(f) && (d = d && d[e[f]]);
  89. return c ? j(d) : d
  90. },
  91. m = function() {
  92. return !!(navigator.userAgent.indexOf("MSIE ") > 0 || navigator.userAgent.match(/Trident.*rv\:11\./))
  93. },
  94. n = function() {
  95. Object.keys || (Object.keys = function() {
  96. var a = Object.prototype.hasOwnProperty,
  97. b = !{
  98. toString: null
  99. }.propertyIsEnumerable("toString"),
  100. c = ["toString", "toLocaleString", "valueOf", "hasOwnProperty", "isPrototypeOf", "propertyIsEnumerable", "constructor"],
  101. d = c.length;
  102. return function(e) {
  103. if("object" != typeof e && ("function" != typeof e || null === e)) throw new TypeError("Object.keys called on non-object");
  104. var f, g, h = [];
  105. for(f in e) a.call(e, f) && h.push(f);
  106. if(b)
  107. for(g = 0; d > g; g++) a.call(e, c[g]) && h.push(c[g]);
  108. return h
  109. }
  110. }())
  111. },
  112. o = function(b, c) {
  113. this.options = c, this.$el = a(b), this.$el_ = this.$el.clone(), this.timeoutId_ = 0, this.timeoutFooter_ = 0, this.init()
  114. };
  115. o.DEFAULTS = {
  116. classes: "table table-hover",
  117. sortClass: void 0,
  118. locale: void 0,
  119. height: void 0,
  120. undefinedText: "-",
  121. sortName: void 0,
  122. sortOrder: "asc",
  123. sortStable: !1,
  124. striped: !1,
  125. columns: [
  126. []
  127. ],
  128. data: [],
  129. totalField: "total",
  130. dataField: "rows",
  131. method: "get",
  132. url: void 0,
  133. ajax: void 0,
  134. cache: !0,
  135. contentType: "application/json",
  136. dataType: "json",
  137. ajaxOptions: {},
  138. queryParams: function(a) {
  139. return a
  140. },
  141. queryParamsType: "limit",
  142. responseHandler: function(a) {
  143. return a
  144. },
  145. pagination: !1,
  146. onlyInfoPagination: !1,
  147. paginationLoop: !0,
  148. sidePagination: "client",
  149. totalRows: 0,
  150. pageNumber: 1,
  151. pageSize: 10,
  152. pageList: [10, 25, 50, 100],
  153. paginationHAlign: "right",
  154. paginationVAlign: "bottom",
  155. paginationDetailHAlign: "left",
  156. paginationPreText: "&lsaquo;",
  157. paginationNextText: "&rsaquo;",
  158. search: !1,
  159. searchOnEnterKey: !1,
  160. strictSearch: !1,
  161. searchAlign: "right",
  162. selectItemName: "btSelectItem",
  163. showHeader: !0,
  164. showFooter: !1,
  165. showColumns: !1,
  166. showPaginationSwitch: !1,
  167. showRefresh: !1,
  168. showToggle: !1,
  169. buttonsAlign: "right",
  170. smartDisplay: !0,
  171. escape: !1,
  172. minimumCountColumns: 1,
  173. idField: void 0,
  174. uniqueId: void 0,
  175. cardView: !1,
  176. detailView: !1,
  177. detailFormatter: function() {
  178. return ""
  179. },
  180. trimOnSearch: !0,
  181. clickToSelect: !1,
  182. singleSelect: !1,
  183. toolbar: void 0,
  184. toolbarAlign: "left",
  185. checkboxHeader: !0,
  186. sortable: !0,
  187. silentSort: !0,
  188. maintainSelected: !1,
  189. searchTimeOut: 500,
  190. searchText: "",
  191. iconSize: void 0,
  192. buttonsClass: "default",
  193. iconsPrefix: "glyphicon",
  194. icons: {
  195. paginationSwitchDown: "glyphicon-collapse-down icon-chevron-down",
  196. paginationSwitchUp: "glyphicon-collapse-up icon-chevron-up",
  197. refresh: "glyphicon-refresh icon-refresh",
  198. toggle: "glyphicon-list-alt icon-list-alt",
  199. columns: "glyphicon-th icon-th",
  200. detailOpen: "glyphicon-plus icon-plus",
  201. detailClose: "glyphicon-minus icon-minus"
  202. },
  203. customSearch: a.noop,
  204. customSort: a.noop,
  205. rowStyle: function() {
  206. return {}
  207. },
  208. rowAttributes: function() {
  209. return {}
  210. },
  211. footerStyle: function() {
  212. return {}
  213. },
  214. onAll: function() {
  215. return !1
  216. },
  217. onClickCell: function() {
  218. return !1
  219. },
  220. onDblClickCell: function() {
  221. return !1
  222. },
  223. onClickRow: function() {
  224. return !1
  225. },
  226. onDblClickRow: function() {
  227. return !1
  228. },
  229. onSort: function() {
  230. return !1
  231. },
  232. onCheck: function() {
  233. return !1
  234. },
  235. onUncheck: function() {
  236. return !1
  237. },
  238. onCheckAll: function() {
  239. return !1
  240. },
  241. onUncheckAll: function() {
  242. return !1
  243. },
  244. onCheckSome: function() {
  245. return !1
  246. },
  247. onUncheckSome: function() {
  248. return !1
  249. },
  250. onLoadSuccess: function() {
  251. return !1
  252. },
  253. onLoadError: function() {
  254. return !1
  255. },
  256. onColumnSwitch: function() {
  257. return !1
  258. },
  259. onPageChange: function() {
  260. return !1
  261. },
  262. onSearch: function() {
  263. return !1
  264. },
  265. onToggle: function() {
  266. return !1
  267. },
  268. onPreBody: function() {
  269. return !1
  270. },
  271. onPostBody: function() {
  272. return !1
  273. },
  274. onPostHeader: function() {
  275. return !1
  276. },
  277. onExpandRow: function() {
  278. return !1
  279. },
  280. onCollapseRow: function() {
  281. return !1
  282. },
  283. onRefreshOptions: function() {
  284. return !1
  285. },
  286. onRefresh: function() {
  287. return !1
  288. },
  289. onResetView: function() {
  290. return !1
  291. }
  292. }, o.LOCALES = {}, o.LOCALES["en-US"] = o.LOCALES.en = {
  293. formatLoadingMessage: function() {
  294. return "Loading, please wait..."
  295. },
  296. formatRecordsPerPage: function(a) {
  297. return c("%s rows per page", a)
  298. },
  299. formatShowingRows: function(a, b, d) {
  300. return c("Showing %s to %s of %s rows", a, b, d)
  301. },
  302. formatDetailPagination: function(a) {
  303. return c("Showing %s rows", a)
  304. },
  305. formatSearch: function() {
  306. return "Search"
  307. },
  308. formatNoMatches: function() {
  309. return "No matching records found"
  310. },
  311. formatPaginationSwitch: function() {
  312. return "Hide/Show pagination"
  313. },
  314. formatRefresh: function() {
  315. return "Refresh"
  316. },
  317. formatToggle: function() {
  318. return "Toggle"
  319. },
  320. formatColumns: function() {
  321. return "Columns"
  322. },
  323. formatAllRows: function() {
  324. return "All"
  325. }
  326. }, a.extend(o.DEFAULTS, o.LOCALES["en-US"]), o.COLUMN_DEFAULTS = {
  327. radio: !1,
  328. checkbox: !1,
  329. checkboxEnabled: !0,
  330. field: void 0,
  331. title: void 0,
  332. titleTooltip: void 0,
  333. "class": void 0,
  334. align: void 0,
  335. halign: void 0,
  336. falign: void 0,
  337. valign: void 0,
  338. width: void 0,
  339. sortable: !1,
  340. order: "asc",
  341. visible: !0,
  342. switchable: !0,
  343. clickToSelect: !0,
  344. formatter: void 0,
  345. footerFormatter: void 0,
  346. events: void 0,
  347. sorter: void 0,
  348. sortName: void 0,
  349. cellStyle: void 0,
  350. searchable: !0,
  351. searchFormatter: !0,
  352. cardVisible: !0,
  353. escape: !1
  354. }, o.EVENTS = {
  355. "all.bs.table": "onAll",
  356. "click-cell.bs.table": "onClickCell",
  357. "dbl-click-cell.bs.table": "onDblClickCell",
  358. "click-row.bs.table": "onClickRow",
  359. "dbl-click-row.bs.table": "onDblClickRow",
  360. "sort.bs.table": "onSort",
  361. "check.bs.table": "onCheck",
  362. "uncheck.bs.table": "onUncheck",
  363. "check-all.bs.table": "onCheckAll",
  364. "uncheck-all.bs.table": "onUncheckAll",
  365. "check-some.bs.table": "onCheckSome",
  366. "uncheck-some.bs.table": "onUncheckSome",
  367. "load-success.bs.table": "onLoadSuccess",
  368. "load-error.bs.table": "onLoadError",
  369. "column-switch.bs.table": "onColumnSwitch",
  370. "page-change.bs.table": "onPageChange",
  371. "search.bs.table": "onSearch",
  372. "toggle.bs.table": "onToggle",
  373. "pre-body.bs.table": "onPreBody",
  374. "post-body.bs.table": "onPostBody",
  375. "post-header.bs.table": "onPostHeader",
  376. "expand-row.bs.table": "onExpandRow",
  377. "collapse-row.bs.table": "onCollapseRow",
  378. "refresh-options.bs.table": "onRefreshOptions",
  379. "reset-view.bs.table": "onResetView",
  380. "refresh.bs.table": "onRefresh"
  381. }, o.prototype.init = function() {
  382. this.initLocale(), this.initContainer(), this.initTable(), this.initHeader(), this.initData(), this.initHiddenRows(), this.initFooter(), this.initToolbar(), this.initPagination(), this.initBody(), this.initSearchText(), this.initServer()
  383. }, o.prototype.initLocale = function() {
  384. if(this.options.locale) {
  385. var b = this.options.locale.split(/-|_/);
  386. b[0].toLowerCase(), b[1] && b[1].toUpperCase(), a.fn.bootstrapTable.locales[this.options.locale] ? a.extend(this.options, a.fn.bootstrapTable.locales[this.options.locale]) : a.fn.bootstrapTable.locales[b.join("-")] ? a.extend(this.options, a.fn.bootstrapTable.locales[b.join("-")]) : a.fn.bootstrapTable.locales[b[0]] && a.extend(this.options, a.fn.bootstrapTable.locales[b[0]])
  387. }
  388. }, o.prototype.initContainer = function() {
  389. this.$container = a(['<div class="bootstrap-table">', '<div class="fixed-table-toolbar"></div>', "top" === this.options.paginationVAlign || "both" === this.options.paginationVAlign ? '<div class="fixed-table-pagination" style="clear: both;"></div>' : "", '<div class="fixed-table-container">', '<div class="fixed-table-header"><table></table></div>', '<div class="fixed-table-body">', '<div class="fixed-table-loading">', this.options.formatLoadingMessage(), "</div>", "</div>", '<div class="fixed-table-footer"><table><tr></tr></table></div>', "bottom" === this.options.paginationVAlign || "both" === this.options.paginationVAlign ? '<div class="fixed-table-pagination"></div>' : "", "</div>", "</div>"].join("")), this.$container.insertAfter(this.$el), this.$tableContainer = this.$container.find(".fixed-table-container"), this.$tableHeader = this.$container.find(".fixed-table-header"), this.$tableBody = this.$container.find(".fixed-table-body"), this.$tableLoading = this.$container.find(".fixed-table-loading"), this.$tableFooter = this.$container.find(".fixed-table-footer"), this.$toolbar = this.$container.find(".fixed-table-toolbar"), this.$pagination = this.$container.find(".fixed-table-pagination"), this.$tableBody.append(this.$el), this.$container.after('<div class="clearfix"></div>'), this.$el.addClass(this.options.classes), this.options.striped && this.$el.addClass("table-striped"), -1 !== a.inArray("table-no-bordered", this.options.classes.split(" ")) && this.$tableContainer.addClass("table-no-bordered")
  390. }, o.prototype.initTable = function() {
  391. var b = this,
  392. c = [],
  393. d = [];
  394. if(this.$header = this.$el.find(">thead"), this.$header.length || (this.$header = a("<thead></thead>").appendTo(this.$el)), this.$header.find("tr").each(function() {
  395. var b = [];
  396. a(this).find("th").each(function() {
  397. "undefined" != typeof a(this).data("field") && a(this).data("field", a(this).data("field") + ""), b.push(a.extend({}, {
  398. title: a(this).html(),
  399. "class": a(this).attr("class"),
  400. titleTooltip: a(this).attr("title"),
  401. rowspan: a(this).attr("rowspan") ? +a(this).attr("rowspan") : void 0,
  402. colspan: a(this).attr("colspan") ? +a(this).attr("colspan") : void 0
  403. }, a(this).data()))
  404. }), c.push(b)
  405. }), a.isArray(this.options.columns[0]) || (this.options.columns = [this.options.columns]), this.options.columns = a.extend(!0, [], c, this.options.columns), this.columns = [], f(this.options.columns), a.each(this.options.columns, function(c, d) {
  406. a.each(d, function(d, e) {
  407. e = a.extend({}, o.COLUMN_DEFAULTS, e), "undefined" != typeof e.fieldIndex && (b.columns[e.fieldIndex] = e), b.options.columns[c][d] = e
  408. })
  409. }), !this.options.data.length) {
  410. var e = [];
  411. this.$el.find(">tbody>tr").each(function(c) {
  412. var f = {};
  413. f._id = a(this).attr("id"), f._class = a(this).attr("class"), f._data = k(a(this).data()), a(this).find(">td").each(function(d) {
  414. for(var g, h, i = a(this), j = +i.attr("colspan") || 1, l = +i.attr("rowspan") || 1; e[c] && e[c][d]; d++);
  415. for(g = d; d + j > g; g++)
  416. for(h = c; c + l > h; h++) e[h] || (e[h] = []), e[h][g] = !0;
  417. var m = b.columns[d].field;
  418. f[m] = a(this).html(), f["_" + m + "_id"] = a(this).attr("id"), f["_" + m + "_class"] = a(this).attr("class"), f["_" + m + "_rowspan"] = a(this).attr("rowspan"), f["_" + m + "_colspan"] = a(this).attr("colspan"), f["_" + m + "_title"] = a(this).attr("title"), f["_" + m + "_data"] = k(a(this).data())
  419. }), d.push(f)
  420. }), this.options.data = d, d.length && (this.fromHtml = !0)
  421. }
  422. }, o.prototype.initHeader = function() {
  423. var b = this,
  424. d = {},
  425. e = [];
  426. this.header = {
  427. fields: [],
  428. styles: [],
  429. classes: [],
  430. formatters: [],
  431. events: [],
  432. sorters: [],
  433. sortNames: [],
  434. cellStyles: [],
  435. searchables: []
  436. }, a.each(this.options.columns, function(f, g) {
  437. e.push("<tr>"), 0 === f && !b.options.cardView && b.options.detailView && e.push(c('<th class="detail" rowspan="%s"><div class="fht-cell"></div></th>', b.options.columns.length)), a.each(g, function(a, f) {
  438. var g = "",
  439. h = "",
  440. i = "",
  441. k = "",
  442. l = c(' class="%s"', f["class"]),
  443. m = (b.options.sortOrder || f.order, "px"),
  444. n = f.width;
  445. if(void 0 === f.width || b.options.cardView || "string" == typeof f.width && -1 !== f.width.indexOf("%") && (m = "%"), f.width && "string" == typeof f.width && (n = f.width.replace("%", "").replace("px", "")), h = c("text-align: %s; ", f.halign ? f.halign : f.align), i = c("text-align: %s; ", f.align), k = c("vertical-align: %s; ", f.valign), k += c("width: %s; ", !f.checkbox && !f.radio || n ? n ? n + m : void 0 : "36px"), "undefined" != typeof f.fieldIndex) {
  446. if(b.header.fields[f.fieldIndex] = f.field, b.header.styles[f.fieldIndex] = i + k, b.header.classes[f.fieldIndex] = l, b.header.formatters[f.fieldIndex] = f.formatter, b.header.events[f.fieldIndex] = f.events, b.header.sorters[f.fieldIndex] = f.sorter, b.header.sortNames[f.fieldIndex] = f.sortName, b.header.cellStyles[f.fieldIndex] = f.cellStyle, b.header.searchables[f.fieldIndex] = f.searchable, !f.visible) return;
  447. if(b.options.cardView && !f.cardVisible) return;
  448. d[f.field] = f
  449. }
  450. e.push("<th" + c(' title="%s"', f.titleTooltip), f.checkbox || f.radio ? c(' class="bs-checkbox %s"', f["class"] || "") : l, c(' style="%s"', h + k), c(' rowspan="%s"', f.rowspan), c(' colspan="%s"', f.colspan), c(' data-field="%s"', f.field), ">"), e.push(c('<div class="th-inner %s">', b.options.sortable && f.sortable ? "sortable both" : "")), g = b.options.escape ? j(f.title) : f.title, f.checkbox && (!b.options.singleSelect && b.options.checkboxHeader && (g = '<input name="btSelectAll" type="checkbox" />'), b.header.stateField = f.field), f.radio && (g = "", b.header.stateField = f.field, b.options.singleSelect = !0), e.push(g), e.push("</div>"), e.push('<div class="fht-cell"></div>'), e.push("</div>"), e.push("</th>")
  451. }), e.push("</tr>")
  452. }), this.$header.html(e.join("")), this.$header.find("th[data-field]").each(function() {
  453. a(this).data(d[a(this).data("field")])
  454. }), this.$container.off("click", ".th-inner").on("click", ".th-inner", function(c) {
  455. var d = a(this);
  456. return b.options.detailView && d.closest(".bootstrap-table")[0] !== b.$container[0] ? !1 : void(b.options.sortable && d.parent().data().sortable && b.onSort(c))
  457. }), this.$header.children().children().off("keypress").on("keypress", function(c) {
  458. if(b.options.sortable && a(this).data().sortable) {
  459. var d = c.keyCode || c.which;
  460. 13 == d && b.onSort(c)
  461. }
  462. }), a(window).off("resize.bootstrap-table"), !this.options.showHeader || this.options.cardView ? (this.$header.hide(), this.$tableHeader.hide(), this.$tableLoading.css("top", 0)) : (this.$header.show(), this.$tableHeader.show(), this.$tableLoading.css("top", this.$header.outerHeight() + 1), this.getCaret(), a(window).on("resize.bootstrap-table", a.proxy(this.resetWidth, this))), this.$selectAll = this.$header.find('[name="btSelectAll"]'), this.$selectAll.off("click").on("click", function() {
  463. var c = a(this).prop("checked");
  464. b[c ? "checkAll" : "uncheckAll"](), b.updateSelected()
  465. })
  466. }, o.prototype.initFooter = function() {
  467. !this.options.showFooter || this.options.cardView ? this.$tableFooter.hide() : this.$tableFooter.show()
  468. }, o.prototype.initData = function(a, b) {
  469. this.data = "append" === b ? this.data.concat(a) : "prepend" === b ? [].concat(a).concat(this.data) : a || this.options.data, this.options.data = "append" === b ? this.options.data.concat(a) : "prepend" === b ? [].concat(a).concat(this.options.data) : this.data, "server" !== this.options.sidePagination && this.initSort()
  470. }, o.prototype.initSort = function() {
  471. var b = this,
  472. d = this.options.sortName,
  473. e = "desc" === this.options.sortOrder ? -1 : 1,
  474. f = a.inArray(this.options.sortName, this.header.fields),
  475. g = 0;
  476. return this.options.customSort !== a.noop ? void this.options.customSort.apply(this, [this.options.sortName, this.options.sortOrder]) : void(-1 !== f && (this.options.sortStable && a.each(this.data, function(a, b) {
  477. b.hasOwnProperty("_position") || (b._position = a)
  478. }), this.data.sort(function(c, g) {
  479. b.header.sortNames[f] && (d = b.header.sortNames[f]);
  480. var i = l(c, d, b.options.escape),
  481. j = l(g, d, b.options.escape),
  482. k = h(b.header, b.header.sorters[f], [i, j]);
  483. return void 0 !== k ? e * k : ((void 0 === i || null === i) && (i = ""), (void 0 === j || null === j) && (j = ""), b.options.sortStable && i === j && (i = c._position, j = g._position), a.isNumeric(i) && a.isNumeric(j) ? (i = parseFloat(i), j = parseFloat(j), j > i ? -1 * e : e) : i === j ? 0 : ("string" != typeof i && (i = i.toString()), -1 === i.localeCompare(j) ? -1 * e : e))
  484. }), void 0 !== this.options.sortClass && (clearTimeout(g), g = setTimeout(function() {
  485. b.$el.removeClass(b.options.sortClass);
  486. var a = b.$header.find(c('[data-field="%s"]', b.options.sortName).index() + 1);
  487. b.$el.find(c("tr td:nth-child(%s)", a)).addClass(b.options.sortClass)
  488. }, 250))))
  489. }, o.prototype.onSort = function(b) {
  490. var c = "keypress" === b.type ? a(b.currentTarget) : a(b.currentTarget).parent(),
  491. d = this.$header.find("th").eq(c.index());
  492. return this.$header.add(this.$header_).find("span.order").remove(), this.options.sortName === c.data("field") ? this.options.sortOrder = "asc" === this.options.sortOrder ? "desc" : "asc" : (this.options.sortName = c.data("field"), this.options.sortOrder = "asc" === c.data("order") ? "desc" : "asc"), this.trigger("sort", this.options.sortName, this.options.sortOrder), c.add(d).data("order", this.options.sortOrder), this.getCaret(), "server" === this.options.sidePagination ? void this.initServer(this.options.silentSort) : (this.initSort(), void this.initBody())
  493. }, o.prototype.initToolbar = function() {
  494. var b, d, e = this,
  495. f = [],
  496. g = 0,
  497. i = 0;
  498. this.$toolbar.find(".bs-bars").children().length && a("body").append(a(this.options.toolbar)), this.$toolbar.html(""), ("string" == typeof this.options.toolbar || "object" == typeof this.options.toolbar) && a(c('<div class="bs-bars pull-%s"></div>', this.options.toolbarAlign)).appendTo(this.$toolbar).append(a(this.options.toolbar)), f = [c('<div class="columns columns-%s btn-group pull-%s">', this.options.buttonsAlign, this.options.buttonsAlign)], "string" == typeof this.options.icons && (this.options.icons = h(null, this.options.icons)), this.options.showPaginationSwitch && f.push(c('<button class="btn' + c(" btn-%s", this.options.buttonsClass) + c(" btn-%s", this.options.iconSize) + '" type="button" name="paginationSwitch" aria-label="pagination Switch" title="%s">', this.options.formatPaginationSwitch()), c('<i class="%s %s"></i>', this.options.iconsPrefix, this.options.icons.paginationSwitchDown), "</button>"), this.options.showRefresh && f.push(c('<button class="btn' + c(" btn-%s", this.options.buttonsClass) + c(" btn-%s", this.options.iconSize) + '" type="button" name="refresh" aria-label="refresh" title="%s">', this.options.formatRefresh()), c('<i class="%s %s"></i>', this.options.iconsPrefix, this.options.icons.refresh), "</button>"), this.options.showToggle && f.push(c('<button class="btn' + c(" btn-%s", this.options.buttonsClass) + c(" btn-%s", this.options.iconSize) + '" type="button" name="toggle" aria-label="toggle" title="%s">', this.options.formatToggle()), c('<i class="%s %s"></i>', this.options.iconsPrefix, this.options.icons.toggle), "</button>"), this.options.showColumns && (f.push(c('<div class="keep-open btn-group" title="%s">', this.options.formatColumns()), '<button type="button" aria-label="columns" class="btn' + c(" btn-%s", this.options.buttonsClass) + c(" btn-%s", this.options.iconSize) + ' dropdown-toggle" data-toggle="dropdown">', c('<i class="%s %s"></i>', this.options.iconsPrefix, this.options.icons.columns), ' <span class="caret"></span>', "</button>", '<ul class="dropdown-menu" role="menu">'), a.each(this.columns, function(a, b) {
  499. if(!(b.radio || b.checkbox || e.options.cardView && !b.cardVisible)) {
  500. var d = b.visible ? ' checked="checked"' : "";
  501. b.switchable && (f.push(c('<li role="menuitem"><label><input type="checkbox" data-field="%s" value="%s"%s> %s</label></li>', b.field, a, d, b.title)), i++)
  502. }
  503. }), f.push("</ul>", "</div>")), f.push("</div>"), (this.showToolbar || f.length > 2) && this.$toolbar.append(f.join("")), this.options.showPaginationSwitch && this.$toolbar.find('button[name="paginationSwitch"]').off("click").on("click", a.proxy(this.togglePagination, this)), this.options.showRefresh && this.$toolbar.find('button[name="refresh"]').off("click").on("click", a.proxy(this.refresh, this)), this.options.showToggle && this.$toolbar.find('button[name="toggle"]').off("click").on("click", function() {
  504. e.toggleView()
  505. }), this.options.showColumns && (b = this.$toolbar.find(".keep-open"), i <= this.options.minimumCountColumns && b.find("input").prop("disabled", !0), b.find("li").off("click").on("click", function(a) {
  506. a.stopImmediatePropagation()
  507. }), b.find("input").off("click").on("click", function() {
  508. var b = a(this);
  509. e.toggleColumn(a(this).val(), b.prop("checked"), !1), e.trigger("column-switch", a(this).data("field"), b.prop("checked"))
  510. })), this.options.search && (f = [], f.push('<div class="pull-' + this.options.searchAlign + ' search">', c('<input class="form-control' + c(" input-%s", this.options.iconSize) + '" type="text" placeholder="%s">', this.options.formatSearch()), "</div>"), this.$toolbar.append(f.join("")), d = this.$toolbar.find(".search input"), d.off("keyup drop blur").on("keyup drop blur", function(b) {
  511. e.options.searchOnEnterKey && 13 !== b.keyCode || a.inArray(b.keyCode, [37, 38, 39, 40]) > -1 || (clearTimeout(g), g = setTimeout(function() {
  512. e.onSearch(b)
  513. }, e.options.searchTimeOut))
  514. }), m() && d.off("mouseup").on("mouseup", function(a) {
  515. clearTimeout(g), g = setTimeout(function() {
  516. e.onSearch(a)
  517. }, e.options.searchTimeOut)
  518. }))
  519. }, o.prototype.onSearch = function(b) {
  520. var c = a.trim(a(b.currentTarget).val());
  521. this.options.trimOnSearch && a(b.currentTarget).val() !== c && a(b.currentTarget).val(c), c !== this.searchText && (this.searchText = c, this.options.searchText = c, this.options.pageNumber = 1, this.initSearch(), this.updatePagination(), this.trigger("search", c))
  522. }, o.prototype.initSearch = function() {
  523. var b = this;
  524. if("server" !== this.options.sidePagination) {
  525. if(this.options.customSearch !== a.noop) return void this.options.customSearch.apply(this, [this.searchText]);
  526. var c = this.searchText && (this.options.escape ? j(this.searchText) : this.searchText).toLowerCase(),
  527. d = a.isEmptyObject(this.filterColumns) ? null : this.filterColumns;
  528. this.data = d ? a.grep(this.options.data, function(b) {
  529. for(var c in d)
  530. if(a.isArray(d[c]) && -1 === a.inArray(b[c], d[c]) || !a.isArray(d[c]) && b[c] !== d[c]) return !1;
  531. return !0
  532. }) : this.options.data, this.data = c ? a.grep(this.data, function(d, f) {
  533. for(var g = 0; g < b.header.fields.length; g++)
  534. if(b.header.searchables[g]) {
  535. var i, j = a.isNumeric(b.header.fields[g]) ? parseInt(b.header.fields[g], 10) : b.header.fields[g],
  536. k = b.columns[e(b.columns, j)];
  537. if("string" == typeof j) {
  538. i = d;
  539. for(var l = j.split("."), m = 0; m < l.length; m++) i = i[l[m]];
  540. k && k.searchFormatter && (i = h(k, b.header.formatters[g], [i, d, f], i))
  541. } else i = d[j];
  542. if("string" == typeof i || "number" == typeof i)
  543. if(b.options.strictSearch) {
  544. if((i + "").toLowerCase() === c) return !0
  545. } else if(-1 !== (i + "").toLowerCase().indexOf(c)) return !0
  546. }
  547. return !1
  548. }) : this.data
  549. }
  550. }, o.prototype.initPagination = function() {
  551. if(!this.options.pagination) return void this.$pagination.hide();
  552. this.$pagination.show();
  553. var b, d, e, f, g, h, i, j, k, l = this,
  554. m = [],
  555. n = !1,
  556. o = this.getData(),
  557. p = this.options.pageList,
  558. t;
  559. if("server" !== this.options.sidePagination && (this.options.totalRows = o.length), this.totalPages = 0, this.options.totalRows) {
  560. if(this.options.pageSize === this.options.formatAllRows()) this.options.pageSize = this.options.totalRows, n = !0;
  561. else if(this.options.pageSize === this.options.totalRows) {
  562. var q = "string" == typeof this.options.pageList ? this.options.pageList.replace("[", "").replace("]", "").replace(/ /g, "").toLowerCase().split(",") : this.options.pageList;
  563. a.inArray(this.options.formatAllRows().toLowerCase(), q) > -1 && (n = !0)
  564. }
  565. this.totalPages = ~~((this.options.totalRows - 1) / this.options.pageSize) + 1, this.options.totalPages = this.totalPages
  566. }
  567. if (this.totalPages > 0 && this.options.pageNumber > this.totalPages && (this.options.pageNumber = this.totalPages), this.pageFrom = (this.options.pageNumber - 1) * this.options.pageSize + 1, this.pageTo = this.options.pageNumber * this.options.pageSize, this.pageTo > this.options.totalRows && (this.pageTo = this.options.totalRows),
  568. m.push('<div class="pull-' + this.options.paginationDetailHAlign + ' pagination-detail">', '<span class="pagination-info">', this.options.onlyInfoPagination ? this.options.formatDetailPagination(this.options.totalRows) : this.options.formatShowingRows(this.pageFrom, this.pageTo, this.options.totalRows), "</span>"),
  569. !this.options.onlyInfoPagination) {
  570. m.push('<span class="page-list">');
  571. var r = [c('<span class="btn-group %s">', "top" === this.options.paginationVAlign || "both" === this.options.paginationVAlign ? "dropdown" : "dropup"), '<button type="button" class="btn' + c(" btn-%s", this.options.buttonsClass) + c(" btn-%s", this.options.iconSize) + ' dropdown-toggle" data-toggle="dropdown">', '<span class="page-size">', n ? this.options.formatAllRows() : this.options.pageSize, "</span>", ' <span class="caret"></span>', "</button>", '<ul class="dropdown-menu" role="menu">'];
  572. if ("string" == typeof this.options.pageList) {
  573. var s = this.options.pageList.replace("[", "").replace("]", "").replace(/ /g, "").split(",");
  574. p = [], a.each(s, function (a, b) {
  575. p.push(b.toUpperCase() === l.options.formatAllRows().toUpperCase() ? l.options.formatAllRows() : +b)
  576. })
  577. }
  578. for (a.each(p, function (a, b) {
  579. if (!l.options.smartDisplay || 0 === a || p[a - 1] < l.options.totalRows) {
  580. var d;
  581. d = n ? b === l.options.formatAllRows() ? ' class="active"' : "" : b === l.options.pageSize ? ' class="active"' : "", r.push(c('<li role="menuitem"%s><a href="#">%s</a></li>', d, b))
  582. }
  583. }),
  584. r.push("</ul></span>"),
  585. m.push(this.options.formatRecordsPerPage(r.join(""))),
  586. m.push("</span>"),
  587. m.push("</div>", '<div class="pull-' + this.options.paginationHAlign + ' pagination">', '<ul class="pagination' + c(" pagination-%s", this.options.iconSize) + '">', '<li class="page-pre"><a href="#">' + this.options.paginationPreText + "</a></li>"), this.totalPages < 5 ? (d = 1, e = this.totalPages) : (d = this.options.pageNumber - 2, e = d + 4, 1 > d && (d = 1, e = 5), e > this.totalPages && (e = this.totalPages, d = e - 4)), this.totalPages >= 6 && (this.options.pageNumber >= 3 && (m.push('<li class="page-first' + (1 === this.options.pageNumber ? " active" : "") + '">', '<a href="#">', 1, "</a>", "</li>"), d++), this.options.pageNumber >= 4 && (4 == this.options.pageNumber || 6 == this.totalPages || 7 == this.totalPages ? d-- : m.push('<li class="page-first-separator disabled">', '<a href="#">...</a>', "</li>"), e--)), this.totalPages >= 7 && this.options.pageNumber >= this.totalPages - 2 && d--, 6 == this.totalPages ? this.options.pageNumber >= this.totalPages - 2 && e++ : this.totalPages >= 7 && (7 == this.totalPages || this.options.pageNumber >= this.totalPages - 3) && e++, b = d; e >= b; b++)
  588. m.push('<li class="page-number' + (b === this.options.pageNumber * 1 ? " active" : "") + '">', '<a href="#">', b, "</a>", "</li>");
  589. this.totalPages >= 8 && this.options.pageNumber <= this.totalPages - 4 && m.push('<li class="page-last-separator disabled">', '<a href="#">...</a>', "</li>"),
  590. this.totalPages >= 6 && this.options.pageNumber <= this.totalPages - 3 && m.push('<li class="page-last' + (this.totalPages === this.options.pageNumber ? " active" : "") + '">', '<a href="#">', this.totalPages, "</a>", "</li>"),
  591. m.push('<li class="page-next"><a href="#">' + this.options.paginationNextText + "</a></li>", "</ul>", '<div style="float:right;margin:0 20px;width:180px;" class="input-group"><div class="input-group-addon">跳转到</div><input type="text" class="JumpPage form-control" value="' + this.options.pageNumber + '" /><div class="input-group-addon">页</div></div>', "</div>")
  592. }
  593. this.$pagination.html(m.join("")), this.options.onlyInfoPagination || (
  594. f = this.$pagination.find(".page-list a"),
  595. g = this.$pagination.find(".page-first"),
  596. h = this.$pagination.find(".page-pre"),
  597. i = this.$pagination.find(".page-next"),
  598. j = this.$pagination.find(".page-last"),
  599. k = this.$pagination.find(".page-number"),
  600. t = this.$pagination.find(".JumpPage"),
  601. this.options.smartDisplay && (this.totalPages <= 1 && this.$pagination.find("div.pagination").hide(), (p.length < 2 || this.options.totalRows <= p[0]) && this.$pagination.find("span.page-list").hide(), this.$pagination[this.getData().length ? "show" : "hide"]()), this.options.paginationLoop || (1 === this.options.pageNumber && h.addClass("disabled"), this.options.pageNumber === this.totalPages && i.addClass("disabled")), n && (this.options.pageSize = this.options.formatAllRows()),
  602. f.off("click").on("click", a.proxy(this.onPageListChange, this)),
  603. g.off("click").on("click", a.proxy(this.onPageFirst, this)),
  604. h.off("click").on("click", a.proxy(this.onPagePre, this)),
  605. i.off("click").on("click", a.proxy(this.onPageNext, this)),
  606. j.off("click").on("click", a.proxy(this.onPageLast, this)),
  607. k.off("click").on("click", a.proxy(this.onPageNumber, this)),
  608. t.off("keydown").on("keydown", a.proxy(this.onJumpNumber, this))
  609. )
  610. }, o.prototype.updatePagination = function(b) {
  611. b && a(b.currentTarget).hasClass("disabled") || (this.options.maintainSelected || this.resetRows(), this.initPagination(), "server" === this.options.sidePagination ? this.initServer() : this.initBody(), this.trigger("page-change", this.options.pageNumber, this.options.pageSize))
  612. }, o.prototype.onPageListChange = function(b) {
  613. var c = a(b.currentTarget);
  614. return c.parent().addClass("active").siblings().removeClass("active"), this.options.pageSize = c.text().toUpperCase() === this.options.formatAllRows().toUpperCase() ? this.options.formatAllRows() : +c.text(), this.$toolbar.find(".page-size").text(this.options.pageSize), this.updatePagination(b), !1
  615. }, o.prototype.onPageFirst = function(a) {
  616. return this.options.pageNumber = 1, this.updatePagination(a), !1
  617. }, o.prototype.onPagePre = function(a) {
  618. return this.options.pageNumber - 1 === 0 ? this.options.pageNumber = this.options.totalPages : this.options.pageNumber--, this.updatePagination(a), !1
  619. }, o.prototype.onPageNext = function(a) {
  620. return this.options.pageNumber + 1 > this.options.totalPages ? this.options.pageNumber = 1 : this.options.pageNumber++, this.updatePagination(a), !1
  621. }, o.prototype.onPageLast = function(a) {
  622. return this.options.pageNumber = this.totalPages, this.updatePagination(a), !1
  623. }, o.prototype.onPageNumber = function(b) {
  624. return this.options.pageNumber !== +a(b.currentTarget).text() ? (this.options.pageNumber = +a(b.currentTarget).text(), this.updatePagination(b), !1) : void 0
  625. }, o.prototype.onJumpNumber = function (b) {
  626. var code = b.keyCode || b.which || b.charCode;
  627. if (code == "13") {
  628. var r = /^\+?[1-9][0-9]*$/;
  629. var n = a(b.currentTarget).val();
  630. if (r.test(n)) {
  631. return this.options.pageNumber !== +n ? (this.options.pageNumber = +n, this.updatePagination(b), !1) : void 0
  632. }
  633. }
  634. }, o.prototype.initRow = function (b, e) {
  635. var f, g = this,
  636. i = [],
  637. k = {},
  638. m = [],
  639. n = "",
  640. o = {},
  641. p = [];
  642. if(!(a.inArray(b, this.hiddenRows) > -1)) {
  643. if(k = h(this.options, this.options.rowStyle, [b, e], k), k && k.css)
  644. for(f in k.css) m.push(f + ": " + k.css[f]);
  645. if(o = h(this.options, this.options.rowAttributes, [b, e], o))
  646. for(f in o) p.push(c('%s="%s"', f, j(o[f])));
  647. return b._data && !a.isEmptyObject(b._data) && a.each(b._data, function(a, b) {
  648. "index" !== a && (n += c(' data-%s="%s"', a, b))
  649. }), i.push("<tr", c(" %s", p.join(" ")), c(' id="%s"', a.isArray(b) ? void 0 : b._id), c(' class="%s"', k.classes || (a.isArray(b) ? void 0 : b._class)), c(' data-index="%s"', e), c(' data-uniqueid="%s"', b[this.options.uniqueId]), c("%s", n), ">"), this.options.cardView && i.push(c('<td colspan="%s"><div class="card-views">', this.header.fields.length)), !this.options.cardView && this.options.detailView && i.push("<td>", '<a class="detail-icon" href="#">', c('<i class="%s %s"></i>', this.options.iconsPrefix, this.options.icons.detailOpen), "</a>", "</td>"), a.each(this.header.fields, function(f, n) {
  650. var o = "",
  651. p = l(b, n, g.options.escape),
  652. q = "",
  653. r = "",
  654. s = {},
  655. t = "",
  656. u = g.header.classes[f],
  657. v = "",
  658. w = "",
  659. x = "",
  660. y = "",
  661. z = g.columns[f];
  662. if(!(g.fromHtml && "undefined" == typeof p || !z.visible || g.options.cardView && !z.cardVisible)) {
  663. if(z.escape && (p = j(p)), k = c('style="%s"', m.concat(g.header.styles[f]).join("; ")), b["_" + n + "_id"] && (t = c(' id="%s"', b["_" + n + "_id"])), b["_" + n + "_class"] && (u = c(' class="%s"', b["_" + n + "_class"])), b["_" + n + "_rowspan"] && (w = c(' rowspan="%s"', b["_" + n + "_rowspan"])), b["_" + n + "_colspan"] && (x = c(' colspan="%s"', b["_" + n + "_colspan"])), b["_" + n + "_title"] && (y = c(' title="%s"', b["_" + n + "_title"])), s = h(g.header, g.header.cellStyles[f], [p, b, e, n], s), s.classes && (u = c(' class="%s"', s.classes)), s.css) {
  664. var A = [];
  665. for(var B in s.css) A.push(B + ": " + s.css[B]);
  666. k = c('style="%s"', A.concat(g.header.styles[f]).join("; "))
  667. }
  668. q = h(z, g.header.formatters[f], [p, b, e], p), b["_" + n + "_data"] && !a.isEmptyObject(b["_" + n + "_data"]) && a.each(b["_" + n + "_data"], function(a, b) {
  669. "index" !== a && (v += c(' data-%s="%s"', a, b))
  670. }), z.checkbox || z.radio ? (r = z.checkbox ? "checkbox" : r, r = z.radio ? "radio" : r, o = [c(g.options.cardView ? '<div class="card-view %s">' : '<td class="bs-checkbox %s">', z["class"] || ""), "<input" + c(' data-index="%s"', e) + c(' name="%s"', g.options.selectItemName) + c(' type="%s"', r) + c(' value="%s"', b[g.options.idField]) + c(' checked="%s"', q === !0 || p || q && q.checked ? "checked" : void 0) + c(' disabled="%s"', !z.checkboxEnabled || q && q.disabled ? "disabled" : void 0) + " />", g.header.formatters[f] && "string" == typeof q ? q : "", g.options.cardView ? "</div>" : "</td>"].join(""), b[g.header.stateField] = q === !0 || q && q.checked) : (q = "undefined" == typeof q || null === q ? g.options.undefinedText : q, o = g.options.cardView ? ['<div class="card-view">', g.options.showHeader ? c('<span class="title" %s>%s</span>', k, d(g.columns, "field", "title", n)) : "", c('<span class="value">%s</span>', q), "</div>"].join("") : [c("<td%s %s %s %s %s %s %s>", t, u, k, v, w, x, y), q, "</td>"].join(""), g.options.cardView && g.options.smartDisplay && "" === q && (o = '<div class="card-view"></div>')), i.push(o)
  671. }
  672. }), this.options.cardView && i.push("</div></td>"), i.push("</tr>"), i.join(" ")
  673. }
  674. }, o.prototype.initBody = function(b) {
  675. var d = this,
  676. f = this.getData();
  677. this.trigger("pre-body", f), this.$body = this.$el.find(">tbody"), this.$body.length || (this.$body = a("<tbody></tbody>").appendTo(this.$el)), this.options.pagination && "server" !== this.options.sidePagination || (this.pageFrom = 1, this.pageTo = f.length);
  678. for(var g, i = a(document.createDocumentFragment()), j = this.pageFrom - 1; j < this.pageTo; j++) {
  679. var k = f[j],
  680. m = this.initRow(k, j, f, i);
  681. g = g || !!m, m && m !== !0 && i.append(m)
  682. }
  683. g || i.append('<tr class="no-records-found">' + c('<td colspan="%s">%s</td>', this.$header.find("th").length, this.options.formatNoMatches()) + "</tr>"), this.$body.html(i), b || this.scrollTo(0), this.$body.find("> tr[data-index] > td").off("click dblclick").on("click dblclick", function(b) {
  684. var f = a(this),
  685. g = f.parent(),
  686. h = d.data[g.data("index")],
  687. i = f[0].cellIndex,
  688. j = d.getVisibleFields(),
  689. k = j[d.options.detailView && !d.options.cardView ? i - 1 : i],
  690. m = d.columns[e(d.columns, k)],
  691. n = l(h, k, d.options.escape);
  692. if(!f.find(".detail-icon").length && (d.trigger("click" === b.type ? "click-cell" : "dbl-click-cell", k, n, h, f), d.trigger("click" === b.type ? "click-row" : "dbl-click-row", h, g, k), "click" === b.type && d.options.clickToSelect && m.clickToSelect)) {
  693. var o = g.find(c('[name="%s"]', d.options.selectItemName));
  694. o.length && o[0].click()
  695. }
  696. }), this.$body.find("> tr[data-index] > td > .detail-icon").off("click").on("click", function() {
  697. var b = a(this),
  698. e = b.parent().parent(),
  699. g = e.data("index"),
  700. i = f[g];
  701. if(e.next().is("tr.detail-view")) b.find("i").attr("class", c("%s %s", d.options.iconsPrefix, d.options.icons.detailOpen)), d.trigger("collapse-row", g, i), e.next().remove();
  702. else {
  703. b.find("i").attr("class", c("%s %s", d.options.iconsPrefix, d.options.icons.detailClose)), e.after(c('<tr class="detail-view"><td colspan="%s"></td></tr>', e.find("td").length));
  704. var j = e.next().find("td"),
  705. k = h(d.options, d.options.detailFormatter, [g, i, j], "");
  706. 1 === j.length && j.append(k), d.trigger("expand-row", g, i, j)
  707. }
  708. return d.resetView(), !1
  709. }), this.$selectItem = this.$body.find(c('[name="%s"]', this.options.selectItemName)), this.$selectItem.off("click").on("click", function(b) {
  710. b.stopImmediatePropagation();
  711. var c = a(this),
  712. e = c.prop("checked"),
  713. f = d.data[c.data("index")];
  714. d.options.maintainSelected && a(this).is(":radio") && a.each(d.options.data, function(a, b) {
  715. b[d.header.stateField] = !1
  716. }), f[d.header.stateField] = e, d.options.singleSelect && (d.$selectItem.not(this).each(function() {
  717. d.data[a(this).data("index")][d.header.stateField] = !1
  718. }), d.$selectItem.filter(":checked").not(this).prop("checked", !1)), d.updateSelected(), d.trigger(e ? "check" : "uncheck", f, c)
  719. }), a.each(this.header.events, function(b, c) {
  720. if(c) {
  721. "string" == typeof c && (c = h(null, c));
  722. var e = d.header.fields[b],
  723. f = a.inArray(e, d.getVisibleFields());
  724. d.options.detailView && !d.options.cardView && (f += 1);
  725. for(var g in c) d.$body.find(">tr:not(.no-records-found)").each(function() {
  726. var b = a(this),
  727. h = b.find(d.options.cardView ? ".card-view" : "td").eq(f),
  728. i = g.indexOf(" "),
  729. j = g.substring(0, i),
  730. k = g.substring(i + 1),
  731. l = c[g];
  732. h.find(k).off(j).on(j, function(a) {
  733. var c = b.data("index"),
  734. f = d.data[c],
  735. g = f[e];
  736. l.apply(this, [a, g, f, c])
  737. })
  738. })
  739. }
  740. }), this.updateSelected(), this.resetView(), this.trigger("post-body", f)
  741. }, o.prototype.initServer = function(b, c, d) {
  742. var e, f = this,
  743. g = {},
  744. i = {
  745. searchText: this.searchText,
  746. sortName: this.options.sortName,
  747. sortOrder: this.options.sortOrder
  748. };
  749. this.options.pagination && (i.pageSize = this.options.pageSize === this.options.formatAllRows() ? this.options.totalRows : this.options.pageSize, i.pageNumber = this.options.pageNumber), (d || this.options.url || this.options.ajax) && ("limit" === this.options.queryParamsType && (i = {
  750. search: i.searchText,
  751. sort: i.sortName,
  752. order: i.sortOrder
  753. }, this.options.pagination && (i.offset = this.options.pageSize === this.options.formatAllRows() ? 0 : this.options.pageSize * (this.options.pageNumber - 1), i.limit = this.options.pageSize === this.options.formatAllRows() ? this.options.totalRows : this.options.pageSize)), a.isEmptyObject(this.filterColumnsPartial) || (i.filter = JSON.stringify(this.filterColumnsPartial, null)), g = h(this.options, this.options.queryParams, [i], g), a.extend(g, c || {}), g !== !1 && (b || this.$tableLoading.show(), e = a.extend({}, h(null, this.options.ajaxOptions), {
  754. type: this.options.method,
  755. url: d || this.options.url,
  756. data: "application/json" === this.options.contentType && "post" === this.options.method ? JSON.stringify(g) : g,
  757. cache: this.options.cache,
  758. contentType: this.options.contentType,
  759. dataType: this.options.dataType,
  760. success: function(a) {
  761. a = h(f.options, f.options.responseHandler, [a], a), f.load(a), f.trigger("load-success", a), b || f.$tableLoading.hide()
  762. },
  763. error: function(a) {
  764. f.trigger("load-error", a.status, a), b || f.$tableLoading.hide()
  765. }
  766. }), this.options.ajax ? h(this, this.options.ajax, [e], null) : (this._xhr && 4 !== this._xhr.readyState && this._xhr.abort(), this._xhr = a.ajax(e))))
  767. }, o.prototype.initSearchText = function() {
  768. if(this.options.search && "" !== this.options.searchText) {
  769. var a = this.$toolbar.find(".search input");
  770. a.val(this.options.searchText), this.onSearch({
  771. currentTarget: a
  772. })
  773. }
  774. }, o.prototype.getCaret = function() {
  775. var b = this;
  776. a.each(this.$header.find("th"), function(c, d) {
  777. a(d).find(".sortable").removeClass("desc asc").addClass(a(d).data("field") === b.options.sortName ? b.options.sortOrder : "both")
  778. })
  779. }, o.prototype.updateSelected = function() {
  780. var b = this.$selectItem.filter(":enabled").length && this.$selectItem.filter(":enabled").length === this.$selectItem.filter(":enabled").filter(":checked").length;
  781. this.$selectAll.add(this.$selectAll_).prop("checked", b), this.$selectItem.each(function() {
  782. a(this).closest("tr")[a(this).prop("checked") ? "addClass" : "removeClass"]("selected")
  783. })
  784. }, o.prototype.updateRows = function() {
  785. var b = this;
  786. this.$selectItem.each(function() {
  787. b.data[a(this).data("index")][b.header.stateField] = a(this).prop("checked")
  788. })
  789. }, o.prototype.resetRows = function() {
  790. var b = this;
  791. a.each(this.data, function(a, c) {
  792. b.$selectAll.prop("checked", !1), b.$selectItem.prop("checked", !1), b.header.stateField && (c[b.header.stateField] = !1)
  793. }), this.initHiddenRows()
  794. }, o.prototype.trigger = function(b) {
  795. var c = Array.prototype.slice.call(arguments, 1);
  796. b += ".bs.table", this.options[o.EVENTS[b]].apply(this.options, c), this.$el.trigger(a.Event(b), c), this.options.onAll(b, c), this.$el.trigger(a.Event("all.bs.table"), [b, c])
  797. }, o.prototype.resetHeader = function() {
  798. clearTimeout(this.timeoutId_), this.timeoutId_ = setTimeout(a.proxy(this.fitHeader, this), this.$el.is(":hidden") ? 100 : 0)
  799. }, o.prototype.fitHeader = function() {
  800. var b, d, e, f, h = this;
  801. if(h.$el.is(":hidden")) return void(h.timeoutId_ = setTimeout(a.proxy(h.fitHeader, h), 100));
  802. if(b = this.$tableBody.get(0), d = b.scrollWidth > b.clientWidth && b.scrollHeight > b.clientHeight + this.$header.outerHeight() ? g() : 0, this.$el.css("margin-top", -this.$header.outerHeight()), e = a(":focus"), e.length > 0) {
  803. var i = e.parents("th");
  804. if(i.length > 0) {
  805. var j = i.attr("data-field");
  806. if(void 0 !== j) {
  807. var k = this.$header.find("[data-field='" + j + "']");
  808. k.length > 0 && k.find(":input").addClass("focus-temp")
  809. }
  810. }
  811. }
  812. this.$header_ = this.$header.clone(!0, !0), this.$selectAll_ = this.$header_.find('[name="btSelectAll"]'), this.$tableHeader.css({
  813. "margin-right": d
  814. }).find("table").css("width", this.$el.outerWidth()).html("").attr("class", this.$el.attr("class")).append(this.$header_), f = a(".focus-temp:visible:eq(0)"), f.length > 0 && (f.focus(), this.$header.find(".focus-temp").removeClass("focus-temp")), this.$header.find("th[data-field]").each(function() {
  815. h.$header_.find(c('th[data-field="%s"]', a(this).data("field"))).data(a(this).data())
  816. });
  817. var l = this.getVisibleFields(),
  818. m = this.$header_.find("th");
  819. this.$body.find(">tr:first-child:not(.no-records-found) > *").each(function(b) {
  820. var d = a(this),
  821. e = b;
  822. h.options.detailView && !h.options.cardView && (0 === b && h.$header_.find("th.detail").find(".fht-cell").width(d.innerWidth()), e = b - 1);
  823. var f = h.$header_.find(c('th[data-field="%s"]', l[e]));
  824. f.length > 1 && (f = a(m[d[0].cellIndex])), f.find(".fht-cell").width(d.innerWidth())
  825. }), this.$tableBody.off("scroll").on("scroll", function() {
  826. h.$tableHeader.scrollLeft(a(this).scrollLeft()), h.options.showFooter && !h.options.cardView && h.$tableFooter.scrollLeft(a(this).scrollLeft())
  827. }), h.trigger("post-header")
  828. }, o.prototype.resetFooter = function() {
  829. var b = this,
  830. d = b.getData(),
  831. e = [];
  832. this.options.showFooter && !this.options.cardView && (!this.options.cardView && this.options.detailView && e.push('<td><div class="th-inner">&nbsp;</div><div class="fht-cell"></div></td>'), a.each(this.columns, function(a, f) {
  833. var g, i = "",
  834. j = "",
  835. k = [],
  836. l = {},
  837. m = c(' class="%s"', f["class"]);
  838. if(f.visible && (!b.options.cardView || f.cardVisible)) {
  839. if(i = c("text-align: %s; ", f.falign ? f.falign : f.align), j = c("vertical-align: %s; ", f.valign), l = h(null, b.options.footerStyle), l && l.css)
  840. for(g in l.css) k.push(g + ": " + l.css[g]);
  841. e.push("<td", m, c(' style="%s"', i + j + k.concat().join("; ")), ">"), e.push('<div class="th-inner">'), e.push(h(f, f.footerFormatter, [d], "&nbsp;") || "&nbsp;"), e.push("</div>"), e.push('<div class="fht-cell"></div>'), e.push("</div>"), e.push("</td>")
  842. }
  843. }), this.$tableFooter.find("tr").html(e.join("")), this.$tableFooter.show(), clearTimeout(this.timeoutFooter_), this.timeoutFooter_ = setTimeout(a.proxy(this.fitFooter, this), this.$el.is(":hidden") ? 100 : 0))
  844. }, o.prototype.fitFooter = function() {
  845. var b, c, d;
  846. return clearTimeout(this.timeoutFooter_), this.$el.is(":hidden") ? void(this.timeoutFooter_ = setTimeout(a.proxy(this.fitFooter, this), 100)) : (c = this.$el.css("width"), d = c > this.$tableBody.width() ? g() : 0, this.$tableFooter.css({
  847. "margin-right": d
  848. }).find("table").css("width", c).attr("class", this.$el.attr("class")), b = this.$tableFooter.find("td"), void this.$body.find(">tr:first-child:not(.no-records-found) > *").each(function(c) {
  849. var d = a(this);
  850. b.eq(c).find(".fht-cell").width(d.innerWidth())
  851. }))
  852. }, o.prototype.toggleColumn = function(a, b, d) {
  853. if(-1 !== a && (this.columns[a].visible = b, this.initHeader(), this.initSearch(), this.initPagination(), this.initBody(), this.options.showColumns)) {
  854. var e = this.$toolbar.find(".keep-open input").prop("disabled", !1);
  855. d && e.filter(c('[value="%s"]', a)).prop("checked", b), e.filter(":checked").length <= this.options.minimumCountColumns && e.filter(":checked").prop("disabled", !0)
  856. }
  857. }, o.prototype.getVisibleFields = function() {
  858. var b = this,
  859. c = [];
  860. return a.each(this.header.fields, function(a, d) {
  861. var f = b.columns[e(b.columns, d)];
  862. f.visible && c.push(d)
  863. }), c
  864. }, o.prototype.resetView = function(a) {
  865. var b = 0;
  866. if(a && a.height && (this.options.height = a.height), this.$selectAll.prop("checked", this.$selectItem.length > 0 && this.$selectItem.length === this.$selectItem.filter(":checked").length), this.options.height) {
  867. var c = this.$toolbar.outerHeight(!0),
  868. d = this.$pagination.outerHeight(!0),
  869. e = this.options.height - c - d;
  870. this.$tableContainer.css("height", e + "px")
  871. }
  872. return this.options.cardView ? (this.$el.css("margin-top", "0"), this.$tableContainer.css("padding-bottom", "0"), void this.$tableFooter.hide()) : (this.options.showHeader && this.options.height ? (this.$tableHeader.show(), this.resetHeader(), b += this.$header.outerHeight()) : (this.$tableHeader.hide(), this.trigger("post-header")), this.options.showFooter && (this.resetFooter(), this.options.height && (b += this.$tableFooter.outerHeight() + 1)), this.getCaret(), this.$tableContainer.css("padding-bottom", b + "px"), void this.trigger("reset-view"))
  873. }, o.prototype.getData = function(b) {
  874. return !this.searchText && a.isEmptyObject(this.filterColumns) && a.isEmptyObject(this.filterColumnsPartial) ? b ? this.options.data.slice(this.pageFrom - 1, this.pageTo) : this.options.data : b ? this.data.slice(this.pageFrom - 1, this.pageTo) : this.data
  875. }, o.prototype.load = function(b) {
  876. var c = !1;
  877. "server" === this.options.sidePagination ? (this.options.totalRows = b[this.options.totalField], c = b.fixedScroll, b = b[this.options.dataField]) : a.isArray(b) || (c = b.fixedScroll, b = b.data), this.initData(b), this.initSearch(), this.initPagination(), this.initBody(c)
  878. }, o.prototype.append = function(a) {
  879. this.initData(a, "append"), this.initSearch(), this.initPagination(), this.initSort(), this.initBody(!0)
  880. }, o.prototype.prepend = function(a) {
  881. this.initData(a, "prepend"), this.initSearch(), this.initPagination(), this.initSort(), this.initBody(!0)
  882. }, o.prototype.remove = function(b) {
  883. var c, d, e = this.options.data.length;
  884. if(b.hasOwnProperty("field") && b.hasOwnProperty("values")) {
  885. for(c = e - 1; c >= 0; c--) d = this.options.data[c], d.hasOwnProperty(b.field) && -1 !== a.inArray(d[b.field], b.values) && (this.options.data.splice(c, 1), "server" === this.options.sidePagination && (this.options.totalRows -= 1));
  886. e !== this.options.data.length && (this.initSearch(), this.initPagination(), this.initSort(), this.initBody(!0))
  887. }
  888. }, o.prototype.removeAll = function() {
  889. this.options.data.length > 0 && (this.options.data.splice(0, this.options.data.length), this.initSearch(), this.initPagination(), this.initBody(!0))
  890. }, o.prototype.getRowByUniqueId = function(a) {
  891. var b, c, d, e = this.options.uniqueId,
  892. f = this.options.data.length,
  893. g = null;
  894. for(b = f - 1; b >= 0; b--) {
  895. if(c = this.options.data[b], c.hasOwnProperty(e)) d = c[e];
  896. else {
  897. if(!c._data.hasOwnProperty(e)) continue;
  898. d = c._data[e]
  899. }
  900. if("string" == typeof d ? a = a.toString() : "number" == typeof d && (Number(d) === d && d % 1 === 0 ? a = parseInt(a) : d === Number(d) && 0 !== d && (a = parseFloat(a))), d === a) {
  901. g = c;
  902. break
  903. }
  904. }
  905. return g
  906. }, o.prototype.removeByUniqueId = function(a) {
  907. var b = this.options.data.length,
  908. c = this.getRowByUniqueId(a);
  909. c && this.options.data.splice(this.options.data.indexOf(c), 1), b !== this.options.data.length && (this.initSearch(), this.initPagination(), this.initBody(!0))
  910. }, o.prototype.updateByUniqueId = function(b) {
  911. var c = this,
  912. d = a.isArray(b) ? b : [b];
  913. a.each(d, function(b, d) {
  914. var e;
  915. d.hasOwnProperty("id") && d.hasOwnProperty("row") && (e = a.inArray(c.getRowByUniqueId(d.id), c.options.data), -1 !== e && a.extend(c.options.data[e], d.row))
  916. }), this.initSearch(), this.initPagination(), this.initSort(), this.initBody(!0)
  917. }, o.prototype.insertRow = function(a) {
  918. a.hasOwnProperty("index") && a.hasOwnProperty("row") && (this.data.splice(a.index, 0, a.row), this.initSearch(), this.initPagination(), this.initSort(), this.initBody(!0))
  919. }, o.prototype.updateRow = function(b) {
  920. var c = this,
  921. d = a.isArray(b) ? b : [b];
  922. a.each(d, function(b, d) {
  923. d.hasOwnProperty("index") && d.hasOwnProperty("row") && a.extend(c.options.data[d.index], d.row)
  924. }), this.initSearch(), this.initPagination(), this.initSort(), this.initBody(!0)
  925. }, o.prototype.initHiddenRows = function() {
  926. this.hiddenRows = []
  927. }, o.prototype.showRow = function(a) {
  928. this.toggleRow(a, !0)
  929. }, o.prototype.hideRow = function(a) {
  930. this.toggleRow(a, !1)
  931. }, o.prototype.toggleRow = function(b, c) {
  932. var d, e;
  933. b.hasOwnProperty("index") ? d = this.getData()[b.index] : b.hasOwnProperty("uniqueId") && (d = this.getRowByUniqueId(b.uniqueId)), d && (e = a.inArray(d, this.hiddenRows), c || -1 !== e ? c && e > -1 && this.hiddenRows.splice(e, 1) : this.hiddenRows.push(d), this.initBody(!0))
  934. }, o.prototype.getHiddenRows = function() {
  935. var b = this,
  936. c = this.getData(),
  937. d = [];
  938. return a.each(c, function(c, e) {
  939. a.inArray(e, b.hiddenRows) > -1 && d.push(e)
  940. }), this.hiddenRows = d, d
  941. }, o.prototype.mergeCells = function(b) {
  942. var c, d, e, f = b.index,
  943. g = a.inArray(b.field, this.getVisibleFields()),
  944. h = b.rowspan || 1,
  945. i = b.colspan || 1,
  946. j = this.$body.find(">tr");
  947. if(this.options.detailView && !this.options.cardView && (g += 1), e = j.eq(f).find(">td").eq(g), !(0 > f || 0 > g || f >= this.data.length)) {
  948. for(c = f; f + h > c; c++)
  949. for(d = g; g + i > d; d++) j.eq(c).find(">td").eq(d).hide();
  950. e.attr("rowspan", h).attr("colspan", i).show()
  951. }
  952. }, o.prototype.updateCell = function(a) {
  953. a.hasOwnProperty("index") && a.hasOwnProperty("field") && a.hasOwnProperty("value") && (this.data[a.index][a.field] = a.value, a.reinit !== !1 && (this.initSort(), this.initBody(!0)))
  954. }, o.prototype.getOptions = function() {
  955. return this.options
  956. }, o.prototype.getSelections = function() {
  957. var b = this;
  958. return a.grep(this.options.data, function(a) {
  959. return a[b.header.stateField] === !0
  960. })
  961. }, o.prototype.getAllSelections = function() {
  962. var b = this;
  963. return a.grep(this.options.data, function(a) {
  964. return a[b.header.stateField]
  965. })
  966. }, o.prototype.checkAll = function() {
  967. this.checkAll_(!0)
  968. }, o.prototype.uncheckAll = function() {
  969. this.checkAll_(!1)
  970. }, o.prototype.checkInvert = function() {
  971. var b = this,
  972. c = b.$selectItem.filter(":enabled"),
  973. d = c.filter(":checked");
  974. c.each(function() {
  975. a(this).prop("checked", !a(this).prop("checked"))
  976. }), b.updateRows(), b.updateSelected(), b.trigger("uncheck-some", d), d = b.getSelections(), b.trigger("check-some", d)
  977. }, o.prototype.checkAll_ = function(a) {
  978. var b;
  979. a || (b = this.getSelections()), this.$selectAll.add(this.$selectAll_).prop("checked", a), this.$selectItem.filter(":enabled").prop("checked", a), this.updateRows(), a && (b = this.getSelections()), this.trigger(a ? "check-all" : "uncheck-all", b)
  980. }, o.prototype.check = function(a) {
  981. this.check_(!0, a)
  982. }, o.prototype.uncheck = function(a) {
  983. this.check_(!1, a)
  984. }, o.prototype.check_ = function(a, b) {
  985. var d = this.$selectItem.filter(c('[data-index="%s"]', b)).prop("checked", a);
  986. this.data[b][this.header.stateField] = a, this.updateSelected(), this.trigger(a ? "check" : "uncheck", this.data[b], d)
  987. }, o.prototype.checkBy = function(a) {
  988. this.checkBy_(!0, a)
  989. }, o.prototype.uncheckBy = function(a) {
  990. this.checkBy_(!1, a)
  991. }, o.prototype.checkBy_ = function(b, d) {
  992. if(d.hasOwnProperty("field") && d.hasOwnProperty("values")) {
  993. var e = this,
  994. f = [];
  995. a.each(this.options.data, function(g, h) {
  996. if(!h.hasOwnProperty(d.field)) return !1;
  997. if(-1 !== a.inArray(h[d.field], d.values)) {
  998. var i = e.$selectItem.filter(":enabled").filter(c('[data-index="%s"]', g)).prop("checked", b);
  999. h[e.header.stateField] = b, f.push(h), e.trigger(b ? "check" : "uncheck", h, i)
  1000. }
  1001. }), this.updateSelected(), this.trigger(b ? "check-some" : "uncheck-some", f)
  1002. }
  1003. }, o.prototype.destroy = function() {
  1004. this.$el.insertBefore(this.$container), a(this.options.toolbar).insertBefore(this.$el), this.$container.next().remove(), this.$container.remove(), this.$el.html(this.$el_.html()).css("margin-top", "0").attr("class", this.$el_.attr("class") || "")
  1005. }, o.prototype.showLoading = function() {
  1006. this.$tableLoading.show()
  1007. }, o.prototype.hideLoading = function() {
  1008. this.$tableLoading.hide()
  1009. }, o.prototype.togglePagination = function() {
  1010. this.options.pagination = !this.options.pagination;
  1011. var a = this.$toolbar.find('button[name="paginationSwitch"] i');
  1012. this.options.pagination ? a.attr("class", this.options.iconsPrefix + " " + this.options.icons.paginationSwitchDown) : a.attr("class", this.options.iconsPrefix + " " + this.options.icons.paginationSwitchUp), this.updatePagination()
  1013. }, o.prototype.refresh = function(a) {
  1014. a && a.url && (this.options.url = a.url), a && a.pageNumber && (this.options.pageNumber = a.pageNumber), a && a.pageSize && (this.options.pageSize = a.pageSize), this.initServer(a && a.silent, a && a.query, a && a.url), this.trigger("refresh", a)
  1015. }, o.prototype.resetWidth = function() {
  1016. this.options.showHeader && this.options.height && this.fitHeader(), this.options.showFooter && this.fitFooter()
  1017. }, o.prototype.showColumn = function(a) {
  1018. this.toggleColumn(e(this.columns, a), !0, !0)
  1019. }, o.prototype.hideColumn = function(a) {
  1020. this.toggleColumn(e(this.columns, a), !1, !0)
  1021. }, o.prototype.getHiddenColumns = function() {
  1022. return a.grep(this.columns, function(a) {
  1023. return !a.visible
  1024. })
  1025. }, o.prototype.getVisibleColumns = function() {
  1026. return a.grep(this.columns, function(a) {
  1027. return a.visible
  1028. })
  1029. }, o.prototype.toggleAllColumns = function(b) {
  1030. if(a.each(this.columns, function(a) {
  1031. this.columns[a].visible = b
  1032. }), this.initHeader(), this.initSearch(), this.initPagination(), this.initBody(), this.options.showColumns) {
  1033. var c = this.$toolbar.find(".keep-open input").prop("disabled", !1);
  1034. c.filter(":checked").length <= this.options.minimumCountColumns && c.filter(":checked").prop("disabled", !0)
  1035. }
  1036. }, o.prototype.showAllColumns = function() {
  1037. this.toggleAllColumns(!0)
  1038. }, o.prototype.hideAllColumns = function() {
  1039. this.toggleAllColumns(!1)
  1040. }, o.prototype.filterBy = function(b) {
  1041. this.filterColumns = a.isEmptyObject(b) ? {} : b, this.options.pageNumber = 1, this.initSearch(), this.updatePagination()
  1042. }, o.prototype.scrollTo = function(a) {
  1043. return "string" == typeof a && (a = "bottom" === a ? this.$tableBody[0].scrollHeight : 0), "number" == typeof a && this.$tableBody.scrollTop(a), "undefined" == typeof a ? this.$tableBody.scrollTop() : void 0
  1044. }, o.prototype.getScrollPosition = function() {
  1045. return this.scrollTo()
  1046. }, o.prototype.selectPage = function(a) {
  1047. a > 0 && a <= this.options.totalPages && (this.options.pageNumber = a, this.updatePagination())
  1048. }, o.prototype.prevPage = function() {
  1049. this.options.pageNumber > 1 && (this.options.pageNumber--, this.updatePagination())
  1050. }, o.prototype.nextPage = function() {
  1051. this.options.pageNumber < this.options.totalPages && (this.options.pageNumber++, this.updatePagination())
  1052. }, o.prototype.toggleView = function() {
  1053. this.options.cardView = !this.options.cardView, this.initHeader(), this.initBody(), this.trigger("toggle", this.options.cardView)
  1054. }, o.prototype.refreshOptions = function(b) {
  1055. i(this.options, b, !0) || (this.options = a.extend(this.options, b), this.trigger("refresh-options", this.options), this.destroy(), this.init())
  1056. }, o.prototype.resetSearch = function(a) {
  1057. var b = this.$toolbar.find(".search input");
  1058. b.val(a || ""), this.onSearch({
  1059. currentTarget: b
  1060. })
  1061. }, o.prototype.expandRow_ = function(a, b) {
  1062. var d = this.$body.find(c('> tr[data-index="%s"]', b));
  1063. d.next().is("tr.detail-view") === (a ? !1 : !0) && d.find("> td > .detail-icon").click()
  1064. }, o.prototype.expandRow = function(a) {
  1065. this.expandRow_(!0, a)
  1066. }, o.prototype.collapseRow = function(a) {
  1067. this.expandRow_(!1, a)
  1068. }, o.prototype.expandAllRows = function(b) {
  1069. if(b) {
  1070. var d = this.$body.find(c('> tr[data-index="%s"]', 0)),
  1071. e = this,
  1072. f = null,
  1073. g = !1,
  1074. h = -1;
  1075. if(d.next().is("tr.detail-view") ? d.next().next().is("tr.detail-view") || (d.next().find(".detail-icon").click(), g = !0) : (d.find("> td > .detail-icon").click(), g = !0), g) try {
  1076. h = setInterval(function() {
  1077. f = e.$body.find("tr.detail-view").last().find(".detail-icon"), f.length > 0 ? f.click() : clearInterval(h)
  1078. }, 1)
  1079. } catch(i) {
  1080. clearInterval(h)
  1081. }
  1082. } else
  1083. for(var j = this.$body.children(), k = 0; k < j.length; k++) this.expandRow_(!0, a(j[k]).data("index"))
  1084. }, o.prototype.collapseAllRows = function(b) {
  1085. if(b) this.expandRow_(!1, 0);
  1086. else
  1087. for(var c = this.$body.children(), d = 0; d < c.length; d++) this.expandRow_(!1, a(c[d]).data("index"))
  1088. }, o.prototype.updateFormatText = function(a, b) {
  1089. this.options[c("format%s", a)] && ("string" == typeof b ? this.options[c("format%s", a)] = function() {
  1090. return b
  1091. } : "function" == typeof b && (this.options[c("format%s", a)] = b)), this.initToolbar(), this.initPagination(), this.initBody()
  1092. };
  1093. var p = ["getOptions", "getSelections", "getAllSelections", "getData", "load", "append", "prepend", "remove", "removeAll", "insertRow", "updateRow", "updateCell", "updateByUniqueId", "removeByUniqueId", "getRowByUniqueId", "showRow", "hideRow", "getHiddenRows", "mergeCells", "checkAll", "uncheckAll", "checkInvert", "check", "uncheck", "checkBy", "uncheckBy", "refresh", "resetView", "resetWidth", "destroy", "showLoading", "hideLoading", "showColumn", "hideColumn", "getHiddenColumns", "getVisibleColumns", "showAllColumns", "hideAllColumns", "filterBy", "scrollTo", "getScrollPosition", "selectPage", "prevPage", "nextPage", "togglePagination", "toggleView", "refreshOptions", "resetSearch", "expandRow", "collapseRow", "expandAllRows", "collapseAllRows", "updateFormatText"];
  1094. a.fn.bootstrapTable = function(b) {
  1095. var c, d = Array.prototype.slice.call(arguments, 1);
  1096. return this.each(function() {
  1097. var e = a(this),
  1098. f = e.data("bootstrap.table"),
  1099. g = a.extend({}, o.DEFAULTS, e.data(), "object" == typeof b && b);
  1100. if("string" == typeof b) {
  1101. if(a.inArray(b, p) < 0) throw new Error("Unknown method: " + b);
  1102. if(!f) return;
  1103. c = f[b].apply(f, d), "destroy" === b && e.removeData("bootstrap.table")
  1104. }
  1105. f || e.data("bootstrap.table", f = new o(this, g))
  1106. }), "undefined" == typeof c ? this : c
  1107. }, a.fn.bootstrapTable.Constructor = o, a.fn.bootstrapTable.defaults = o.DEFAULTS, a.fn.bootstrapTable.columnDefaults = o.COLUMN_DEFAULTS, a.fn.bootstrapTable.locales = o.LOCALES, a.fn.bootstrapTable.methods = p, a.fn.bootstrapTable.utils = {
  1108. sprintf: c,
  1109. getFieldIndex: e,
  1110. compareObjects: i,
  1111. calculateObjectValue: h,
  1112. getItemField: l,
  1113. objectKeys: n,
  1114. isIEBrowser: m
  1115. }, a(function() {
  1116. a('[data-toggle="table"]').bootstrapTable()
  1117. })
  1118. //键盘事件
  1119. }(jQuery);