bootstrap.js 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. (function (global, factory) {
  2. if (typeof define === "function" && define.amd) {
  3. define("/tables/bootstrap", ["jquery", "Site"], factory);
  4. } else if (typeof exports !== "undefined") {
  5. factory(require("jquery"), require("Site"));
  6. } else {
  7. var mod = {
  8. exports: {}
  9. };
  10. factory(global.jQuery, global.Site);
  11. global.tablesBootstrap = mod.exports;
  12. }
  13. })(this, function (_jquery, _Site) {
  14. "use strict";
  15. _jquery = babelHelpers.interopRequireDefault(_jquery);
  16. function buildTable($el, cells, rows) {
  17. var i,
  18. j,
  19. row,
  20. columns = [],
  21. data = [];
  22. for (i = 0; i < cells; i++) {
  23. columns.push({
  24. field: 'field' + i,
  25. title: 'Cell' + i
  26. });
  27. }
  28. for (i = 0; i < rows; i++) {
  29. row = {};
  30. for (j = 0; j < cells; j++) {
  31. row['field' + j] = 'Row-' + i + '-' + j;
  32. }
  33. data.push(row);
  34. }
  35. $el.bootstrapTable('destroy').bootstrapTable({
  36. columns: columns,
  37. data: data,
  38. iconSize: 'outline',
  39. icons: {
  40. columns: 'wb-list-bulleted'
  41. }
  42. });
  43. }
  44. (0, _jquery.default)(document).ready(function ($$$1) {
  45. (0, _Site.run)();
  46. }); // Example Bootstrap Table From Data
  47. // ---------------------------------
  48. (function () {
  49. var bt_data = [{
  50. "Tid": "1",
  51. "First": "Jill",
  52. "Last": "Smith",
  53. "Score": "50"
  54. }, {
  55. "Tid": "2",
  56. "First": "Eve",
  57. "Last": "Jackson",
  58. "Score": "94"
  59. }, {
  60. "Tid": "3",
  61. "First": "John",
  62. "Last": "Doe",
  63. "Score": "80"
  64. }, {
  65. "Tid": "4",
  66. "First": "Adam",
  67. "Last": "Johnson",
  68. "Score": "67"
  69. }, {
  70. "Tid": "5",
  71. "First": "Fish",
  72. "Last": "Johnson",
  73. "Score": "100"
  74. }, {
  75. "Tid": "6",
  76. "First": "CC",
  77. "Last": "Joson",
  78. "Score": "77"
  79. }, {
  80. "Tid": "7",
  81. "First": "Piger",
  82. "Last": "Yoson",
  83. "Score": "87"
  84. }];
  85. (0, _jquery.default)('#exampleTableFromData').bootstrapTable({
  86. data: bt_data,
  87. // mobileResponsive: true,
  88. height: "250"
  89. });
  90. })(); // Example Bootstrap Table Columns
  91. // -------------------------------
  92. (function () {
  93. (0, _jquery.default)('#exampleTableColumns').bootstrapTable({
  94. url: "../../assets/data/bootstrap_table_test.json",
  95. height: "400",
  96. iconSize: 'outline',
  97. showColumns: true,
  98. icons: {
  99. refresh: 'wb-refresh',
  100. toggle: 'wb-order',
  101. columns: 'wb-list-bulleted'
  102. }
  103. });
  104. })(); // Example Bootstrap Table Large Columns
  105. // -------------------------------------
  106. buildTable((0, _jquery.default)('#exampleTableLargeColumns'), 50, 50); // Example Bootstrap Table Toolbar
  107. // -------------------------------
  108. (function () {
  109. (0, _jquery.default)('#exampleTableToolbar').bootstrapTable({
  110. url: "../../assets/data/bootstrap_table_test2.json",
  111. search: true,
  112. showRefresh: true,
  113. showToggle: true,
  114. showColumns: true,
  115. toolbar: '#exampleToolbar',
  116. iconSize: 'outline',
  117. icons: {
  118. refresh: 'wb-refresh',
  119. toggle: 'wb-order',
  120. columns: 'wb-list-bulleted'
  121. }
  122. });
  123. })(); // Example Bootstrap Table Events
  124. // ------------------------------
  125. (function () {
  126. (0, _jquery.default)('#exampleTableEvents').bootstrapTable({
  127. url: "../../assets/data/bootstrap_table_test.json",
  128. search: true,
  129. pagination: true,
  130. showRefresh: true,
  131. showToggle: true,
  132. showColumns: true,
  133. iconSize: 'outline',
  134. toolbar: '#exampleTableEventsToolbar',
  135. icons: {
  136. refresh: 'wb-refresh',
  137. toggle: 'wb-order',
  138. columns: 'wb-list-bulleted'
  139. }
  140. });
  141. var $result = (0, _jquery.default)('#examplebtTableEventsResult');
  142. (0, _jquery.default)('#exampleTableEvents').on('all.bs.table', function (e, name, args) {
  143. console.log('Event:', name, ', data:', args);
  144. }).on('click-row.bs.table', function (e, row, $element) {
  145. $result.text('Event: click-row.bs.table');
  146. }).on('dbl-click-row.bs.table', function (e, row, $element) {
  147. $result.text('Event: dbl-click-row.bs.table');
  148. }).on('sort.bs.table', function (e, name, order) {
  149. $result.text('Event: sort.bs.table');
  150. }).on('check.bs.table', function (e, row) {
  151. $result.text('Event: check.bs.table');
  152. }).on('uncheck.bs.table', function (e, row) {
  153. $result.text('Event: uncheck.bs.table');
  154. }).on('check-all.bs.table', function (e) {
  155. $result.text('Event: check-all.bs.table');
  156. }).on('uncheck-all.bs.table', function (e) {
  157. $result.text('Event: uncheck-all.bs.table');
  158. }).on('load-success.bs.table', function (e, data) {
  159. $result.text('Event: load-success.bs.table');
  160. }).on('load-error.bs.table', function (e, status) {
  161. $result.text('Event: load-error.bs.table');
  162. }).on('column-switch.bs.table', function (e, field, checked) {
  163. $result.text('Event: column-switch.bs.table');
  164. }).on('page-change.bs.table', function (e, size, number) {
  165. $result.text('Event: page-change.bs.table');
  166. }).on('search.bs.table', function (e, text) {
  167. $result.text('Event: search.bs.table');
  168. });
  169. })();
  170. });