cre_pro 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (386) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +36 -0
  3. data/lib/cre_pro-rails.rb +8 -0
  4. data/lib/cre_pro/rails.rb +7 -0
  5. data/lib/cre_pro/rails/version.rb +5 -0
  6. data/vendor/assets/javascripts/gp/gp.js +292 -0
  7. data/vendor/assets/javascripts/ld/bootstrap-checkbox-radio-switch-tags.js +869 -0
  8. data/vendor/assets/javascripts/ld/bootstrap-datetimepicker.js +2573 -0
  9. data/vendor/assets/javascripts/ld/bootstrap-notify.js +379 -0
  10. data/vendor/assets/javascripts/ld/bootstrap-selectpicker.js +1711 -0
  11. data/vendor/assets/javascripts/ld/bootstrap-table.js +2484 -0
  12. data/vendor/assets/javascripts/ld/chartist.min.js +8 -0
  13. data/vendor/assets/javascripts/ld/demo.js +731 -0
  14. data/vendor/assets/javascripts/ld/fullcalendar.min.js +9 -0
  15. data/vendor/assets/javascripts/ld/jquery-jvectormap.js +3381 -0
  16. data/vendor/assets/javascripts/ld/jquery-ui.min.js +24 -0
  17. data/vendor/assets/javascripts/ld/jquery.bootstrap.wizard.min.js +22 -0
  18. data/vendor/assets/javascripts/ld/jquery.datatables.js +15498 -0
  19. data/vendor/assets/javascripts/ld/jquery.min.js +5 -0
  20. data/vendor/assets/javascripts/ld/jquery.validate.min.js +4 -0
  21. data/vendor/assets/javascripts/ld/ld.js +422 -0
  22. data/vendor/assets/javascripts/ld/moment.min.js +7 -0
  23. data/vendor/assets/javascripts/ld/sweetalert2.js +877 -0
  24. data/vendor/assets/javascripts/mk/bootstrap-datepicker.js +474 -0
  25. data/vendor/assets/javascripts/mk/bootstrap.min.js +7 -0
  26. data/vendor/assets/javascripts/mk/jasny-bootstrap.min.js +6 -0
  27. data/vendor/assets/javascripts/mk/jquery.dropdown.js +378 -0
  28. data/vendor/assets/javascripts/mk/jquery.flexisel.js +342 -0
  29. data/vendor/assets/javascripts/mk/jquery.min.js +3 -0
  30. data/vendor/assets/javascripts/mk/jquery.tagsinput.js +355 -0
  31. data/vendor/assets/javascripts/mk/mk.js +191 -0
  32. data/vendor/assets/javascripts/mk/mk.min.js +1 -0
  33. data/vendor/assets/javascripts/mk/nouislider.min.js +31 -0
  34. data/vendor/assets/javascripts/pd/bootstrap-checkbox-radio-switch-tags.js +869 -0
  35. data/vendor/assets/javascripts/pd/bootstrap-datetimepicker.js +2576 -0
  36. data/vendor/assets/javascripts/pd/bootstrap-notify.js +379 -0
  37. data/vendor/assets/javascripts/pd/bootstrap-selectpicker.js +1711 -0
  38. data/vendor/assets/javascripts/pd/bootstrap-table.js +2484 -0
  39. data/vendor/assets/javascripts/pd/bootstrap.min.js +12 -0
  40. data/vendor/assets/javascripts/pd/chartist.min.js +9 -0
  41. data/vendor/assets/javascripts/pd/demo.js +911 -0
  42. data/vendor/assets/javascripts/pd/fullcalendar.min.js +9 -0
  43. data/vendor/assets/javascripts/pd/jquery-1.10.2.js +9789 -0
  44. data/vendor/assets/javascripts/pd/jquery-1.10.2.min.js +3 -0
  45. data/vendor/assets/javascripts/pd/jquery-jvectormap.js +3381 -0
  46. data/vendor/assets/javascripts/pd/jquery-ui.min.js +24 -0
  47. data/vendor/assets/javascripts/pd/jquery.bootstrap.wizard.min.js +22 -0
  48. data/vendor/assets/javascripts/pd/jquery.datatables.js +15498 -0
  49. data/vendor/assets/javascripts/pd/jquery.easypiechart.min.js +9 -0
  50. data/vendor/assets/javascripts/pd/jquery.min.js +5 -0
  51. data/vendor/assets/javascripts/pd/jquery.tagsinput.js +355 -0
  52. data/vendor/assets/javascripts/pd/jquery.validate.min.js +4 -0
  53. data/vendor/assets/javascripts/pd/moment.min.js +7 -0
  54. data/vendor/assets/javascripts/pd/pd.js +335 -0
  55. data/vendor/assets/javascripts/pd/sweetalert2.js +877 -0
  56. data/vendor/assets/javascripts/pk/bootstrap-datepicker.js +492 -0
  57. data/vendor/assets/javascripts/pk/bootstrap-select.js +1711 -0
  58. data/vendor/assets/javascripts/pk/chartist.min.js +8 -0
  59. data/vendor/assets/javascripts/pk/ct-pk-bootstrapswitch.js +249 -0
  60. data/vendor/assets/javascripts/pk/ct-pk-checkbox.js +109 -0
  61. data/vendor/assets/javascripts/pk/ct-pk-radio.js +140 -0
  62. data/vendor/assets/javascripts/pk/ct-pk.js +305 -0
  63. data/vendor/assets/javascripts/pk/demo.js +289 -0
  64. data/vendor/assets/javascripts/pk/jasny-bootstrap.min.js +6 -0
  65. data/vendor/assets/javascripts/pk/jquery-1.10.2.js +9789 -0
  66. data/vendor/assets/javascripts/pk/jquery-ui-1.10.4.custom.min.js +6 -0
  67. data/vendor/assets/javascripts/pk/jquery.tagsinput.js +355 -0
  68. data/vendor/assets/javascripts/pk/photo_swipe/init-gallery.js +205 -0
  69. data/vendor/assets/javascripts/pk/photo_swipe/photoswipe-ui-default.min.js +4 -0
  70. data/vendor/assets/javascripts/pk/photo_swipe/photoswipe.min.js +4 -0
  71. data/vendor/assets/javascripts/pk/presentation-page/atv-img-min.js +233 -0
  72. data/vendor/assets/javascripts/pk/presentation-page/jquery.sharrre.js +585 -0
  73. data/vendor/assets/javascripts/sd/bootstrap-datepicker.js +492 -0
  74. data/vendor/assets/javascripts/sd/bootstrap-select.js +1711 -0
  75. data/vendor/assets/javascripts/sd/chartist.min.js +8 -0
  76. data/vendor/assets/javascripts/sd/demo.js +227 -0
  77. data/vendor/assets/javascripts/sd/jquery-ui.custom.min.js +7 -0
  78. data/vendor/assets/javascripts/sd/jquery.flexisel.js +342 -0
  79. data/vendor/assets/javascripts/sd/jquery.js +9789 -0
  80. data/vendor/assets/javascripts/sd/jquery.tagsinput.js +355 -0
  81. data/vendor/assets/javascripts/sd/retina.min.js +10 -0
  82. data/vendor/assets/javascripts/sd/sd-bootstrapswitch.js +249 -0
  83. data/vendor/assets/javascripts/sd/sd-checkbox.js +109 -0
  84. data/vendor/assets/javascripts/sd/sd-morphing.js +89 -0
  85. data/vendor/assets/javascripts/sd/sd-radio.js +140 -0
  86. data/vendor/assets/javascripts/sd/sd.js +398 -0
  87. data/vendor/assets/stylesheets/gp/components/_buttons.scss +121 -0
  88. data/vendor/assets/stylesheets/gp/components/_cards.scss +271 -0
  89. data/vendor/assets/stylesheets/gp/components/_carousel.scss +15 -0
  90. data/vendor/assets/stylesheets/gp/components/_clients.scss +172 -0
  91. data/vendor/assets/stylesheets/gp/components/_closure.scss +19 -0
  92. data/vendor/assets/stylesheets/gp/components/_contact.scss +93 -0
  93. data/vendor/assets/stylesheets/gp/components/_dropdown.scss +173 -0
  94. data/vendor/assets/stylesheets/gp/components/_example-pages.scss +524 -0
  95. data/vendor/assets/stylesheets/gp/components/_footers.scss +191 -0
  96. data/vendor/assets/stylesheets/gp/components/_headers.scss +72 -0
  97. data/vendor/assets/stylesheets/gp/components/_inputs.scss +145 -0
  98. data/vendor/assets/stylesheets/gp/components/_labels.scss +15 -0
  99. data/vendor/assets/stylesheets/gp/components/_misc.scss +332 -0
  100. data/vendor/assets/stylesheets/gp/components/_mixins.scss +11 -0
  101. data/vendor/assets/stylesheets/gp/components/_navbars.scss +252 -0
  102. data/vendor/assets/stylesheets/gp/components/_numbers.scss +61 -0
  103. data/vendor/assets/stylesheets/gp/components/_projects.scss +279 -0
  104. data/vendor/assets/stylesheets/gp/components/_responsive.scss +950 -0
  105. data/vendor/assets/stylesheets/gp/components/_sections.scss +328 -0
  106. data/vendor/assets/stylesheets/gp/components/_social-buttons.scss +30 -0
  107. data/vendor/assets/stylesheets/gp/components/_team.scss +182 -0
  108. data/vendor/assets/stylesheets/gp/components/_theme.scss +22 -0
  109. data/vendor/assets/stylesheets/gp/components/_typography.scss +252 -0
  110. data/vendor/assets/stylesheets/gp/components/_variables.scss +267 -0
  111. data/vendor/assets/stylesheets/gp/components/mixins/_buttons.scss +61 -0
  112. data/vendor/assets/stylesheets/gp/components/mixins/_cards.scss +8 -0
  113. data/vendor/assets/stylesheets/gp/components/mixins/_inputs.scss +17 -0
  114. data/vendor/assets/stylesheets/gp/components/mixins/_navbars.scss +11 -0
  115. data/vendor/assets/stylesheets/gp/components/mixins/_transparency.scss +20 -0
  116. data/vendor/assets/stylesheets/gp/components/mixins/_vendor-prefixes.scss +284 -0
  117. data/vendor/assets/stylesheets/gp/gp.scss +30 -0
  118. data/vendor/assets/stylesheets/ld/ld.scss +53 -0
  119. data/vendor/assets/stylesheets/ld/ld/_alerts.scss +82 -0
  120. data/vendor/assets/stylesheets/ld/ld/_buttons.scss +123 -0
  121. data/vendor/assets/stylesheets/ld/ld/_cards.scss +315 -0
  122. data/vendor/assets/stylesheets/ld/ld/_carousel.scss +15 -0
  123. data/vendor/assets/stylesheets/ld/ld/_checkbox-radio-switch.scss +253 -0
  124. data/vendor/assets/stylesheets/ld/ld/_collapse.scss +49 -0
  125. data/vendor/assets/stylesheets/ld/ld/_dropdown.scss +176 -0
  126. data/vendor/assets/stylesheets/ld/ld/_footers.scss +155 -0
  127. data/vendor/assets/stylesheets/ld/ld/_forms.scss +41 -0
  128. data/vendor/assets/stylesheets/ld/ld/_inputs.scss +170 -0
  129. data/vendor/assets/stylesheets/ld/ld/_labels.scss +54 -0
  130. data/vendor/assets/stylesheets/ld/ld/_media.scss +80 -0
  131. data/vendor/assets/stylesheets/ld/ld/_misc.scss +87 -0
  132. data/vendor/assets/stylesheets/ld/ld/_mixins.scss +22 -0
  133. data/vendor/assets/stylesheets/ld/ld/_modal.scss +79 -0
  134. data/vendor/assets/stylesheets/ld/ld/_navbars.scss +362 -0
  135. data/vendor/assets/stylesheets/ld/ld/_pages.scss +215 -0
  136. data/vendor/assets/stylesheets/ld/ld/_progress-bars.scss +26 -0
  137. data/vendor/assets/stylesheets/ld/ld/_responsive.scss +647 -0
  138. data/vendor/assets/stylesheets/ld/ld/_sidebar-and-main-panel.scss +576 -0
  139. data/vendor/assets/stylesheets/ld/ld/_sliders.scss +219 -0
  140. data/vendor/assets/stylesheets/ld/ld/_social-buttons.scss +77 -0
  141. data/vendor/assets/stylesheets/ld/ld/_tables.scss +120 -0
  142. data/vendor/assets/stylesheets/ld/ld/_tabs-navs-pagination.scss +302 -0
  143. data/vendor/assets/stylesheets/ld/ld/_tags.scss +123 -0
  144. data/vendor/assets/stylesheets/ld/ld/_tooltips-and-popovers.scss +156 -0
  145. data/vendor/assets/stylesheets/ld/ld/_typography.scss +93 -0
  146. data/vendor/assets/stylesheets/ld/ld/_variables.scss +319 -0
  147. data/vendor/assets/stylesheets/ld/ld/mixins/_buttons.scss +74 -0
  148. data/vendor/assets/stylesheets/ld/ld/mixins/_cards.scss +8 -0
  149. data/vendor/assets/stylesheets/ld/ld/mixins/_chartist.scss +85 -0
  150. data/vendor/assets/stylesheets/ld/ld/mixins/_icons.scss +13 -0
  151. data/vendor/assets/stylesheets/ld/ld/mixins/_inputs.scss +17 -0
  152. data/vendor/assets/stylesheets/ld/ld/mixins/_labels.scss +21 -0
  153. data/vendor/assets/stylesheets/ld/ld/mixins/_morphing-buttons.scss +34 -0
  154. data/vendor/assets/stylesheets/ld/ld/mixins/_navbars.scss +11 -0
  155. data/vendor/assets/stylesheets/ld/ld/mixins/_social-buttons.scss +43 -0
  156. data/vendor/assets/stylesheets/ld/ld/mixins/_table-row.scss +22 -0
  157. data/vendor/assets/stylesheets/ld/ld/mixins/_tabs.scss +4 -0
  158. data/vendor/assets/stylesheets/ld/ld/mixins/_transparency.scss +20 -0
  159. data/vendor/assets/stylesheets/ld/ld/mixins/_vendor-prefixes.scss +197 -0
  160. data/vendor/assets/stylesheets/ld/ld/plugins/_animate.scss +188 -0
  161. data/vendor/assets/stylesheets/ld/ld/plugins/_bootstrap-select.scss +308 -0
  162. data/vendor/assets/stylesheets/ld/ld/plugins/_bootstrap-table.scss +328 -0
  163. data/vendor/assets/stylesheets/ld/ld/plugins/_chartist.scss +247 -0
  164. data/vendor/assets/stylesheets/ld/ld/plugins/_datatables.net.scss +513 -0
  165. data/vendor/assets/stylesheets/ld/ld/plugins/_datetime-picker.scss +440 -0
  166. data/vendor/assets/stylesheets/ld/ld/plugins/_fullcalendar.scss +1114 -0
  167. data/vendor/assets/stylesheets/ld/ld/plugins/_jquery.jvectormap.scss +135 -0
  168. data/vendor/assets/stylesheets/ld/ld/plugins/_perfect-scrollbar.scss +111 -0
  169. data/vendor/assets/stylesheets/ld/ld/plugins/_sweetalert2.scss +531 -0
  170. data/vendor/assets/stylesheets/mk/mk.scss +50 -0
  171. data/vendor/assets/stylesheets/mk/mk/_alerts.scss +41 -0
  172. data/vendor/assets/stylesheets/mk/mk/_buttons.scss +283 -0
  173. data/vendor/assets/stylesheets/mk/mk/_cards.scss +576 -0
  174. data/vendor/assets/stylesheets/mk/mk/_carousel.scss +86 -0
  175. data/vendor/assets/stylesheets/mk/mk/_checkboxes.scss +195 -0
  176. data/vendor/assets/stylesheets/mk/mk/_colors.scss +326 -0
  177. data/vendor/assets/stylesheets/mk/mk/_dialogs.scss +99 -0
  178. data/vendor/assets/stylesheets/mk/mk/_dividers.scss +73 -0
  179. data/vendor/assets/stylesheets/mk/mk/_dropdown.scss +86 -0
  180. data/vendor/assets/stylesheets/mk/mk/_example-pages.scss +775 -0
  181. data/vendor/assets/stylesheets/mk/mk/_fileupload.scss +115 -0
  182. data/vendor/assets/stylesheets/mk/mk/_flexisel.scss +54 -0
  183. data/vendor/assets/stylesheets/mk/mk/_form.scss +58 -0
  184. data/vendor/assets/stylesheets/mk/mk/_images.scss +6 -0
  185. data/vendor/assets/stylesheets/mk/mk/_import-bs-less.scss +4 -0
  186. data/vendor/assets/stylesheets/mk/mk/_import-bs-sass.scss +2 -0
  187. data/vendor/assets/stylesheets/mk/mk/_info-areas.scss +57 -0
  188. data/vendor/assets/stylesheets/mk/mk/_inputs-size.scss +223 -0
  189. data/vendor/assets/stylesheets/mk/mk/_inputs.scss +394 -0
  190. data/vendor/assets/stylesheets/mk/mk/_labels.scss +10 -0
  191. data/vendor/assets/stylesheets/mk/mk/_lists.scss +104 -0
  192. data/vendor/assets/stylesheets/mk/mk/_media.scss +47 -0
  193. data/vendor/assets/stylesheets/mk/mk/_misc.scss +94 -0
  194. data/vendor/assets/stylesheets/mk/mk/_mixins.scss +413 -0
  195. data/vendor/assets/stylesheets/mk/mk/_navbar.scss +311 -0
  196. data/vendor/assets/stylesheets/mk/mk/_pagination.scss +91 -0
  197. data/vendor/assets/stylesheets/mk/mk/_panels.scss +47 -0
  198. data/vendor/assets/stylesheets/mk/mk/_pills.scss +128 -0
  199. data/vendor/assets/stylesheets/mk/mk/_popups.scss +77 -0
  200. data/vendor/assets/stylesheets/mk/mk/_progress.scss +33 -0
  201. data/vendor/assets/stylesheets/mk/mk/_radios.scss +114 -0
  202. data/vendor/assets/stylesheets/mk/mk/_responsive.scss +115 -0
  203. data/vendor/assets/stylesheets/mk/mk/_ripples.scss +40 -0
  204. data/vendor/assets/stylesheets/mk/mk/_sections.scss +131 -0
  205. data/vendor/assets/stylesheets/mk/mk/_select.scss +108 -0
  206. data/vendor/assets/stylesheets/mk/mk/_shadows.scss +138 -0
  207. data/vendor/assets/stylesheets/mk/mk/_tables.scss +104 -0
  208. data/vendor/assets/stylesheets/mk/mk/_tabs.scss +53 -0
  209. data/vendor/assets/stylesheets/mk/mk/_tags.scss +97 -0
  210. data/vendor/assets/stylesheets/mk/mk/_togglebutton.scss +87 -0
  211. data/vendor/assets/stylesheets/mk/mk/_typography.scss +75 -0
  212. data/vendor/assets/stylesheets/mk/mk/_variables.scss +224 -0
  213. data/vendor/assets/stylesheets/mk/mk/_variables_bootstrap.scss +883 -0
  214. data/vendor/assets/stylesheets/mk/mk/_welljumbo.scss +28 -0
  215. data/vendor/assets/stylesheets/mk/mk/plugins/_plugin-datepicker.scss +204 -0
  216. data/vendor/assets/stylesheets/mk/mk/plugins/_plugin-nouislider.scss +161 -0
  217. data/vendor/assets/stylesheets/mk/mk/plugins/_plugin-selectize.scss +93 -0
  218. data/vendor/assets/stylesheets/mk/mk/plugins/_plugin-snackbarjs.scss +34 -0
  219. data/vendor/assets/stylesheets/mk/mk/sections/_blogs.scss +17 -0
  220. data/vendor/assets/stylesheets/mk/mk/sections/_contactus.scss +51 -0
  221. data/vendor/assets/stylesheets/mk/mk/sections/_features.scss +92 -0
  222. data/vendor/assets/stylesheets/mk/mk/sections/_footers.scss +163 -0
  223. data/vendor/assets/stylesheets/mk/mk/sections/_headers.scss +125 -0
  224. data/vendor/assets/stylesheets/mk/mk/sections/_pricing.scss +40 -0
  225. data/vendor/assets/stylesheets/mk/mk/sections/_projects.scss +75 -0
  226. data/vendor/assets/stylesheets/mk/mk/sections/_social-subscribe-lines.scss +71 -0
  227. data/vendor/assets/stylesheets/mk/mk/sections/_team.scss +53 -0
  228. data/vendor/assets/stylesheets/mk/mk/sections/_testimonials.scss +5 -0
  229. data/vendor/assets/stylesheets/pd/pd.scss +51 -0
  230. data/vendor/assets/stylesheets/pd/pd/_alerts.scss +60 -0
  231. data/vendor/assets/stylesheets/pd/pd/_animated-buttons.scss +61 -0
  232. data/vendor/assets/stylesheets/pd/pd/_buttons.scss +173 -0
  233. data/vendor/assets/stylesheets/pd/pd/_cards.scss +546 -0
  234. data/vendor/assets/stylesheets/pd/pd/_carousel.scss +15 -0
  235. data/vendor/assets/stylesheets/pd/pd/_chat-message.scss +206 -0
  236. data/vendor/assets/stylesheets/pd/pd/_checkbox-radio.scss +126 -0
  237. data/vendor/assets/stylesheets/pd/pd/_circlechart.scss +18 -0
  238. data/vendor/assets/stylesheets/pd/pd/_collapse.scss +40 -0
  239. data/vendor/assets/stylesheets/pd/pd/_dropdown.scss +413 -0
  240. data/vendor/assets/stylesheets/pd/pd/_footers.scss +87 -0
  241. data/vendor/assets/stylesheets/pd/pd/_forms.scss +43 -0
  242. data/vendor/assets/stylesheets/pd/pd/_inputs.scss +190 -0
  243. data/vendor/assets/stylesheets/pd/pd/_labels.scss +29 -0
  244. data/vendor/assets/stylesheets/pd/pd/_media.scss +80 -0
  245. data/vendor/assets/stylesheets/pd/pd/_misc.scss +104 -0
  246. data/vendor/assets/stylesheets/pd/pd/_mixins.scss +17 -0
  247. data/vendor/assets/stylesheets/pd/pd/_modal.scss +79 -0
  248. data/vendor/assets/stylesheets/pd/pd/_navbars.scss +289 -0
  249. data/vendor/assets/stylesheets/pd/pd/_pages.scss +196 -0
  250. data/vendor/assets/stylesheets/pd/pd/_progress-bars.scss +27 -0
  251. data/vendor/assets/stylesheets/pd/pd/_responsive.scss +666 -0
  252. data/vendor/assets/stylesheets/pd/pd/_sidebar-and-main-panel.scss +514 -0
  253. data/vendor/assets/stylesheets/pd/pd/_sliders.scss +222 -0
  254. data/vendor/assets/stylesheets/pd/pd/_social.scss +130 -0
  255. data/vendor/assets/stylesheets/pd/pd/_switch.scss +145 -0
  256. data/vendor/assets/stylesheets/pd/pd/_tables.scss +194 -0
  257. data/vendor/assets/stylesheets/pd/pd/_tabs-navs-pagination.scss +341 -0
  258. data/vendor/assets/stylesheets/pd/pd/_tags.scss +104 -0
  259. data/vendor/assets/stylesheets/pd/pd/_timeline.scss +178 -0
  260. data/vendor/assets/stylesheets/pd/pd/_tooltips-and-popovers.scss +156 -0
  261. data/vendor/assets/stylesheets/pd/pd/_typography.scss +117 -0
  262. data/vendor/assets/stylesheets/pd/pd/_variables.scss +367 -0
  263. data/vendor/assets/stylesheets/pd/pd/mixins/_alerts.scss +13 -0
  264. data/vendor/assets/stylesheets/pd/pd/mixins/_buttons.scss +89 -0
  265. data/vendor/assets/stylesheets/pd/pd/mixins/_cards.scss +7 -0
  266. data/vendor/assets/stylesheets/pd/pd/mixins/_chartist.scss +104 -0
  267. data/vendor/assets/stylesheets/pd/pd/mixins/_icons.scss +13 -0
  268. data/vendor/assets/stylesheets/pd/pd/mixins/_inputs.scss +17 -0
  269. data/vendor/assets/stylesheets/pd/pd/mixins/_labels.scss +10 -0
  270. data/vendor/assets/stylesheets/pd/pd/mixins/_navbars.scss +11 -0
  271. data/vendor/assets/stylesheets/pd/pd/mixins/_sidebar.scss +54 -0
  272. data/vendor/assets/stylesheets/pd/pd/mixins/_social.scss +68 -0
  273. data/vendor/assets/stylesheets/pd/pd/mixins/_table-row.scss +22 -0
  274. data/vendor/assets/stylesheets/pd/pd/mixins/_tabs.scss +4 -0
  275. data/vendor/assets/stylesheets/pd/pd/mixins/_transparency.scss +20 -0
  276. data/vendor/assets/stylesheets/pd/pd/mixins/_vendor-prefixes.scss +254 -0
  277. data/vendor/assets/stylesheets/pd/pd/plugins/_animate.scss +189 -0
  278. data/vendor/assets/stylesheets/pd/pd/plugins/_bootstrap-select.scss +313 -0
  279. data/vendor/assets/stylesheets/pd/pd/plugins/_bootstrap-table.scss +375 -0
  280. data/vendor/assets/stylesheets/pd/pd/plugins/_chartist.scss +246 -0
  281. data/vendor/assets/stylesheets/pd/pd/plugins/_datatables.net.scss +504 -0
  282. data/vendor/assets/stylesheets/pd/pd/plugins/_datetime-picker.scss +418 -0
  283. data/vendor/assets/stylesheets/pd/pd/plugins/_fullcalendar.scss +1124 -0
  284. data/vendor/assets/stylesheets/pd/pd/plugins/_jquery.jvectormap.scss +135 -0
  285. data/vendor/assets/stylesheets/pd/pd/plugins/_perfect-scrollbar.scss +112 -0
  286. data/vendor/assets/stylesheets/pd/pd/plugins/_sweetalert2.scss +531 -0
  287. data/vendor/assets/stylesheets/pk/ct-pk.scss +64 -0
  288. data/vendor/assets/stylesheets/pk/ct-pk/_alerts.scss +69 -0
  289. data/vendor/assets/stylesheets/pk/ct-pk/_animated-buttons.scss +63 -0
  290. data/vendor/assets/stylesheets/pk/ct-pk/_bootstrap-select.scss +320 -0
  291. data/vendor/assets/stylesheets/pk/ct-pk/_buttons.scss +161 -0
  292. data/vendor/assets/stylesheets/pk/ct-pk/_cards.scss +570 -0
  293. data/vendor/assets/stylesheets/pk/ct-pk/_carousel.scss +59 -0
  294. data/vendor/assets/stylesheets/pk/ct-pk/_chartist.scss +354 -0
  295. data/vendor/assets/stylesheets/pk/ct-pk/_checkbox-radio.scss +129 -0
  296. data/vendor/assets/stylesheets/pk/ct-pk/_collapse.scss +40 -0
  297. data/vendor/assets/stylesheets/pk/ct-pk/_datepicker.scss +198 -0
  298. data/vendor/assets/stylesheets/pk/ct-pk/_dropdown.scss +291 -0
  299. data/vendor/assets/stylesheets/pk/ct-pk/_fileupload.scss +112 -0
  300. data/vendor/assets/stylesheets/pk/ct-pk/_footers.scss +193 -0
  301. data/vendor/assets/stylesheets/pk/ct-pk/_headers.scss +85 -0
  302. data/vendor/assets/stylesheets/pk/ct-pk/_images.scss +28 -0
  303. data/vendor/assets/stylesheets/pk/ct-pk/_info-areas.scss +62 -0
  304. data/vendor/assets/stylesheets/pk/ct-pk/_inputs.scss +171 -0
  305. data/vendor/assets/stylesheets/pk/ct-pk/_labels.scss +29 -0
  306. data/vendor/assets/stylesheets/pk/ct-pk/_media.scss +82 -0
  307. data/vendor/assets/stylesheets/pk/ct-pk/_misc.scss +124 -0
  308. data/vendor/assets/stylesheets/pk/ct-pk/_mixins.scss +16 -0
  309. data/vendor/assets/stylesheets/pk/ct-pk/_modal.scss +91 -0
  310. data/vendor/assets/stylesheets/pk/ct-pk/_navbars.scss +285 -0
  311. data/vendor/assets/stylesheets/pk/ct-pk/_preloaders.scss +282 -0
  312. data/vendor/assets/stylesheets/pk/ct-pk/_progress-bars.scss +27 -0
  313. data/vendor/assets/stylesheets/pk/ct-pk/_responsive.scss +411 -0
  314. data/vendor/assets/stylesheets/pk/ct-pk/_sections.scss +45 -0
  315. data/vendor/assets/stylesheets/pk/ct-pk/_sidebar.scss +206 -0
  316. data/vendor/assets/stylesheets/pk/ct-pk/_sliders.scss +222 -0
  317. data/vendor/assets/stylesheets/pk/ct-pk/_social.scss +130 -0
  318. data/vendor/assets/stylesheets/pk/ct-pk/_switch.scss +145 -0
  319. data/vendor/assets/stylesheets/pk/ct-pk/_tables.scss +135 -0
  320. data/vendor/assets/stylesheets/pk/ct-pk/_tabs-navs-pagination.scss +311 -0
  321. data/vendor/assets/stylesheets/pk/ct-pk/_tags.scss +108 -0
  322. data/vendor/assets/stylesheets/pk/ct-pk/_tooltips-and-popovers.scss +188 -0
  323. data/vendor/assets/stylesheets/pk/ct-pk/_typography.scss +106 -0
  324. data/vendor/assets/stylesheets/pk/ct-pk/_variables.scss +301 -0
  325. data/vendor/assets/stylesheets/pk/ct-pk/mixins/_alerts.scss +11 -0
  326. data/vendor/assets/stylesheets/pk/ct-pk/mixins/_buttons.scss +104 -0
  327. data/vendor/assets/stylesheets/pk/ct-pk/mixins/_inputs.scss +17 -0
  328. data/vendor/assets/stylesheets/pk/ct-pk/mixins/_labels.scss +10 -0
  329. data/vendor/assets/stylesheets/pk/ct-pk/mixins/_navbars.scss +11 -0
  330. data/vendor/assets/stylesheets/pk/ct-pk/mixins/_popovers.scss +21 -0
  331. data/vendor/assets/stylesheets/pk/ct-pk/mixins/_social.scss +68 -0
  332. data/vendor/assets/stylesheets/pk/ct-pk/mixins/_tabs.scss +4 -0
  333. data/vendor/assets/stylesheets/pk/ct-pk/mixins/_transparency.scss +17 -0
  334. data/vendor/assets/stylesheets/pk/ct-pk/mixins/_vendor-prefixes.scss +233 -0
  335. data/vendor/assets/stylesheets/pk/ct-pk/plugins/photo-swipe/_default-skin.scss +592 -0
  336. data/vendor/assets/stylesheets/pk/ct-pk/plugins/photo-swipe/_gallery.scss +27 -0
  337. data/vendor/assets/stylesheets/pk/ct-pk/plugins/photo-swipe/_main-settings.scss +11 -0
  338. data/vendor/assets/stylesheets/pk/ct-pk/plugins/photo-swipe/_main.scss +213 -0
  339. data/vendor/assets/stylesheets/pk/examples.scss +1083 -0
  340. data/vendor/assets/stylesheets/sd/examples.scss +403 -0
  341. data/vendor/assets/stylesheets/sd/sd.scss +41 -0
  342. data/vendor/assets/stylesheets/sd/sd/_alerts.scss +37 -0
  343. data/vendor/assets/stylesheets/sd/sd/_bootstrap-select.scss +307 -0
  344. data/vendor/assets/stylesheets/sd/sd/_buttons.scss +108 -0
  345. data/vendor/assets/stylesheets/sd/sd/_cards.scss +462 -0
  346. data/vendor/assets/stylesheets/sd/sd/_carousel.scss +15 -0
  347. data/vendor/assets/stylesheets/sd/sd/_chartist.scss +335 -0
  348. data/vendor/assets/stylesheets/sd/sd/_checkbox-radio-switch.scss +246 -0
  349. data/vendor/assets/stylesheets/sd/sd/_collapse.scss +33 -0
  350. data/vendor/assets/stylesheets/sd/sd/_datepicker.scss +199 -0
  351. data/vendor/assets/stylesheets/sd/sd/_dropdown.scss +98 -0
  352. data/vendor/assets/stylesheets/sd/sd/_flexisel.scss +53 -0
  353. data/vendor/assets/stylesheets/sd/sd/_footers.scss +216 -0
  354. data/vendor/assets/stylesheets/sd/sd/_icons.scss +127 -0
  355. data/vendor/assets/stylesheets/sd/sd/_inputs.scss +141 -0
  356. data/vendor/assets/stylesheets/sd/sd/_labels.scss +54 -0
  357. data/vendor/assets/stylesheets/sd/sd/_media.scss +80 -0
  358. data/vendor/assets/stylesheets/sd/sd/_misc.scss +115 -0
  359. data/vendor/assets/stylesheets/sd/sd/_mixins.scss +20 -0
  360. data/vendor/assets/stylesheets/sd/sd/_modal.scss +79 -0
  361. data/vendor/assets/stylesheets/sd/sd/_morphing-buttons.scss +161 -0
  362. data/vendor/assets/stylesheets/sd/sd/_navbars.scss +293 -0
  363. data/vendor/assets/stylesheets/sd/sd/_progress-bars.scss +9 -0
  364. data/vendor/assets/stylesheets/sd/sd/_responsive.scss +302 -0
  365. data/vendor/assets/stylesheets/sd/sd/_sections.scss +12 -0
  366. data/vendor/assets/stylesheets/sd/sd/_sidebar-menu.scss +232 -0
  367. data/vendor/assets/stylesheets/sd/sd/_sliders.scss +218 -0
  368. data/vendor/assets/stylesheets/sd/sd/_social-buttons.scss +76 -0
  369. data/vendor/assets/stylesheets/sd/sd/_tables.scss +110 -0
  370. data/vendor/assets/stylesheets/sd/sd/_tabs-navs-pagination.scss +217 -0
  371. data/vendor/assets/stylesheets/sd/sd/_tags.scss +220 -0
  372. data/vendor/assets/stylesheets/sd/sd/_tooltips-and-popovers.scss +156 -0
  373. data/vendor/assets/stylesheets/sd/sd/_typography.scss +73 -0
  374. data/vendor/assets/stylesheets/sd/sd/_variables.scss +249 -0
  375. data/vendor/assets/stylesheets/sd/sd/mixins/_buttons.scss +76 -0
  376. data/vendor/assets/stylesheets/sd/sd/mixins/_cards.scss +8 -0
  377. data/vendor/assets/stylesheets/sd/sd/mixins/_icons.scss +13 -0
  378. data/vendor/assets/stylesheets/sd/sd/mixins/_inputs.scss +17 -0
  379. data/vendor/assets/stylesheets/sd/sd/mixins/_labels.scss +21 -0
  380. data/vendor/assets/stylesheets/sd/sd/mixins/_morphing-buttons.scss +34 -0
  381. data/vendor/assets/stylesheets/sd/sd/mixins/_navbars.scss +11 -0
  382. data/vendor/assets/stylesheets/sd/sd/mixins/_social-buttons.scss +43 -0
  383. data/vendor/assets/stylesheets/sd/sd/mixins/_tabs.scss +4 -0
  384. data/vendor/assets/stylesheets/sd/sd/mixins/_transparency.scss +20 -0
  385. data/vendor/assets/stylesheets/sd/sd/mixins/_vendor-prefixes.scss +177 -0
  386. metadata +484 -0
@@ -0,0 +1,2484 @@
1
+ /**
2
+ * @author zhixin wen <wenzhixin2010@gmail.com>
3
+ * version: 1.8.1
4
+ * https://github.com/wenzhixin/bootstrap-table/
5
+ */
6
+
7
+ ! function ($) {
8
+ 'use strict';
9
+
10
+ // TOOLS DEFINITION
11
+ // ======================
12
+
13
+ var cachedWidth = null;
14
+
15
+ // it only does '%s', and return '' when arguments are undefined
16
+ var sprintf = function (str) {
17
+ var args = arguments,
18
+ flag = true,
19
+ i = 1;
20
+
21
+ str = str.replace(/%s/g, function () {
22
+ var arg = args[i++];
23
+
24
+ if (typeof arg === 'undefined') {
25
+ flag = false;
26
+ return '';
27
+ }
28
+ return arg;
29
+ });
30
+ return flag ? str : '';
31
+ };
32
+
33
+ var getPropertyFromOther = function (list, from, to, value) {
34
+ var result = '';
35
+ $.each(list, function (i, item) {
36
+ if (item[from] === value) {
37
+ result = item[to];
38
+ return false;
39
+ }
40
+ return true;
41
+ });
42
+ return result;
43
+ };
44
+
45
+ var getFieldIndex = function (columns, field) {
46
+ var index = -1;
47
+
48
+ $.each(columns, function (i, column) {
49
+ if (column.field === field) {
50
+ index = i;
51
+ return false;
52
+ }
53
+ return true;
54
+ });
55
+ return index;
56
+ };
57
+
58
+ // http://jsfiddle.net/wenyi/47nz7ez9/3/
59
+ var setFieldIndex = function (columns) {
60
+ var i, j, k,
61
+ totalCol = 0,
62
+ flag = [];
63
+
64
+ for (i = 0; i < columns[0].length; i++) {
65
+ totalCol += columns[0][i].colspan || 1;
66
+ }
67
+
68
+ for (i = 0; i < columns.length; i++) {
69
+ flag[i] = [];
70
+ for (j = 0; j < totalCol; j++) {
71
+ flag[i][j] = false;
72
+ }
73
+ }
74
+
75
+ for (i = 0; i < columns.length; i++) {
76
+ for (j = 0; j < columns[i].length; j++) {
77
+ var r = columns[i][j],
78
+ rowspan = r.rowspan || 1,
79
+ colspan = r.colspan || 1,
80
+ index = $.inArray(false, flag[i]);
81
+
82
+ if (colspan === 1) {
83
+ r.fieldIndex = index;
84
+ // when field is undefined, use index instead
85
+ if (typeof r.field === 'undefined') {
86
+ r.field = index;
87
+ }
88
+ }
89
+
90
+ for (k = 0; k < rowspan; k++) {
91
+ flag[i + k][index] = true;
92
+ }
93
+ for (k = 0; k < colspan; k++) {
94
+ flag[i][index + k] = true;
95
+ }
96
+ }
97
+ }
98
+ }
99
+
100
+ var getScrollBarWidth = function () {
101
+ if (cachedWidth === null) {
102
+ var inner = $('<p/>').addClass('fixed-table-scroll-inner'),
103
+ outer = $('<div/>').addClass('fixed-table-scroll-outer'),
104
+ w1, w2;
105
+
106
+ outer.append(inner);
107
+ $('body').append(outer);
108
+
109
+ w1 = inner[0].offsetWidth;
110
+ outer.css('overflow', 'scroll');
111
+ w2 = inner[0].offsetWidth;
112
+
113
+ if (w1 === w2) {
114
+ w2 = outer[0].clientWidth;
115
+ }
116
+
117
+ outer.remove();
118
+ cachedWidth = w1 - w2;
119
+ }
120
+ return cachedWidth;
121
+ };
122
+
123
+ var calculateObjectValue = function (self, name, args, defaultValue) {
124
+ var func = name;
125
+
126
+ if (typeof name === 'string') {
127
+ // support obj.func1.func2
128
+ var names = name.split('.');
129
+
130
+ if (names.length > 1) {
131
+ func = window;
132
+ $.each(names, function (i, f) {
133
+ func = func[f];
134
+ });
135
+ } else {
136
+ func = window[name];
137
+ }
138
+ }
139
+ if (typeof func === 'object') {
140
+ return func;
141
+ }
142
+ if (typeof func === 'function') {
143
+ return func.apply(self, args);
144
+ }
145
+ if (!func && typeof name === 'string' && sprintf.apply(this, [name].concat(args))) {
146
+ return sprintf.apply(this, [name].concat(args));
147
+ }
148
+ return defaultValue;
149
+ };
150
+
151
+ var compareObjects = function (objectA, objectB, compareLength) {
152
+ // Create arrays of property names
153
+ var objectAProperties = Object.getOwnPropertyNames(objectA),
154
+ objectBProperties = Object.getOwnPropertyNames(objectB),
155
+ propName = '';
156
+
157
+ if (compareLength) {
158
+ // If number of properties is different, objects are not equivalent
159
+ if (objectAProperties.length != objectBProperties.length) {
160
+ return false;
161
+ }
162
+ }
163
+
164
+ for (var i = 0; i < objectAProperties.length; i++) {
165
+ propName = objectAProperties[i];
166
+
167
+ // If the property is not in the object B properties, continue with the next property
168
+ if ($.inArray(propName, objectBProperties) > -1) {
169
+ // If values of same property are not equal, objects are not equivalent
170
+ if (objectA[propName] !== objectB[propName]) {
171
+ return false;
172
+ }
173
+ }
174
+ }
175
+
176
+ // If we made it this far, objects are considered equivalent
177
+ return true;
178
+ };
179
+
180
+ var escapeHTML = function (text) {
181
+ if (typeof text === 'string') {
182
+ return text
183
+ .replace(/&/g, "&amp;")
184
+ .replace(/</g, "&lt;")
185
+ .replace(/>/g, "&gt;")
186
+ .replace(/"/g, "&quot;")
187
+ .replace(/'/g, "&#039;");
188
+ }
189
+ return text;
190
+ };
191
+
192
+ var getRealHeight = function ($el) {
193
+ var height = 0;
194
+ $el.children().each(function () {
195
+ if (height < $(this).outerHeight(true)) {
196
+ height = $(this).outerHeight(true);
197
+ }
198
+ });
199
+ return height;
200
+ };
201
+
202
+ var getRealDataAttr = function (dataAttr) {
203
+ for (var attr in dataAttr) {
204
+ var auxAttr = attr.split(/(?=[A-Z])/).join('-').toLowerCase();
205
+ if (auxAttr !== attr) {
206
+ dataAttr[auxAttr] = dataAttr[attr];
207
+ delete dataAttr[attr];
208
+ }
209
+ }
210
+
211
+ return dataAttr;
212
+ };
213
+
214
+ // BOOTSTRAP TABLE CLASS DEFINITION
215
+ // ======================
216
+
217
+ var BootstrapTable = function (el, options) {
218
+ this.options = options;
219
+ this.$el = $(el);
220
+ this.$el_ = this.$el.clone();
221
+ this.timeoutId_ = 0;
222
+ this.timeoutFooter_ = 0;
223
+
224
+ this.init();
225
+ };
226
+
227
+ BootstrapTable.DEFAULTS = {
228
+ classes: 'table table-hover',
229
+ locale: undefined,
230
+ height: undefined,
231
+ undefinedText: '-',
232
+ sortName: undefined,
233
+ sortOrder: 'asc',
234
+ striped: false,
235
+ columns: [[]],
236
+ data: [],
237
+ method: 'get',
238
+ url: undefined,
239
+ ajax: undefined,
240
+ cache: true,
241
+ contentType: 'application/json',
242
+ dataType: 'json',
243
+ ajaxOptions: {},
244
+ queryParams: function (params) {
245
+ return params;
246
+ },
247
+ queryParamsType: 'limit', // undefined
248
+ responseHandler: function (res) {
249
+ return res;
250
+ },
251
+ pagination: false,
252
+ sidePagination: 'client', // client or server
253
+ totalRows: 0, // server side need to set
254
+ pageNumber: 1,
255
+ pageSize: 10,
256
+ pageList: [10, 25, 50, 100],
257
+ paginationHAlign: 'right', //right, left
258
+ paginationVAlign: 'bottom', //bottom, top, both
259
+ paginationDetailHAlign: 'left', //right, left
260
+ paginationFirstText: '&laquo;',
261
+ paginationPreText: '&lsaquo;',
262
+ paginationNextText: '&rsaquo;',
263
+ paginationLastText: '&raquo;',
264
+ search: false,
265
+ strictSearch: false,
266
+ searchAlign: 'right',
267
+ selectItemName: 'btSelectItem',
268
+ showHeader: true,
269
+ showFooter: false,
270
+ showColumns: false,
271
+ showPaginationSwitch: false,
272
+ showRefresh: false,
273
+ showToggle: false,
274
+ buttonsAlign: 'right',
275
+ smartDisplay: true,
276
+ minimumCountColumns: 1,
277
+ idField: undefined,
278
+ uniqueId: undefined,
279
+ cardView: false,
280
+ detailView: false,
281
+ detailFormatter: function (index, row) {
282
+ return '';
283
+ },
284
+ trimOnSearch: true,
285
+ clickToSelect: false,
286
+ singleSelect: false,
287
+ toolbar: undefined,
288
+ toolbarAlign: 'left',
289
+ checkboxHeader: true,
290
+ sortable: true,
291
+ maintainSelected: false,
292
+ searchTimeOut: 500,
293
+ searchText: '',
294
+ iconSize: undefined,
295
+ iconsPrefix: 'glyphicon', // glyphicon of fa (font awesome)
296
+ icons: {
297
+ paginationSwitchDown: 'glyphicon-collapse-down icon-chevron-down',
298
+ paginationSwitchUp: 'glyphicon-collapse-up icon-chevron-up',
299
+ refresh: 'glyphicon-refresh icon-refresh',
300
+ toggle: 'glyphicon-list-alt icon-list-alt',
301
+ columns: 'glyphicon-th icon-th',
302
+ detailOpen: 'glyphicon-plus icon-plus',
303
+ detailClose: 'glyphicon-minus icon-minus'
304
+ },
305
+
306
+ rowStyle: function (row, index) {
307
+ return {};
308
+ },
309
+
310
+ rowAttributes: function (row, index) {
311
+ return {};
312
+ },
313
+
314
+ onAll: function (name, args) {
315
+ return false;
316
+ },
317
+ onClickCell: function (field, value, row, $element) {
318
+ return false;
319
+ },
320
+ onDblClickCell: function (field, value, row, $element) {
321
+ return false;
322
+ },
323
+ onClickRow: function (item, $element) {
324
+ return false;
325
+ },
326
+ onDblClickRow: function (item, $element) {
327
+ return false;
328
+ },
329
+ onSort: function (name, order) {
330
+ return false;
331
+ },
332
+ onCheck: function (row) {
333
+ return false;
334
+ },
335
+ onUncheck: function (row) {
336
+ return false;
337
+ },
338
+ onCheckAll: function (rows) {
339
+ return false;
340
+ },
341
+ onUncheckAll: function (rows) {
342
+ return false;
343
+ },
344
+ onCheckSome: function (rows) {
345
+ return false;
346
+ },
347
+ onUncheckSome: function (rows) {
348
+ return false;
349
+ },
350
+ onLoadSuccess: function (data) {
351
+ return false;
352
+ },
353
+ onLoadError: function (status) {
354
+ return false;
355
+ },
356
+ onColumnSwitch: function (field, checked) {
357
+ return false;
358
+ },
359
+ onPageChange: function (number, size) {
360
+ return false;
361
+ },
362
+ onSearch: function (text) {
363
+ return false;
364
+ },
365
+ onToggle: function (cardView) {
366
+ return false;
367
+ },
368
+ onPreBody: function (data) {
369
+ return false;
370
+ },
371
+ onPostBody: function () {
372
+ return false;
373
+ },
374
+ onPostHeader: function () {
375
+ return false;
376
+ },
377
+ onExpandRow: function (index, row, $detail) {
378
+ return false;
379
+ },
380
+ onCollapseRow: function (index, row) {
381
+ return false;
382
+ },
383
+ onRefreshOptions: function (options) {
384
+ return false;
385
+ },
386
+ onResetView: function () {
387
+ return false;
388
+ }
389
+ };
390
+
391
+ BootstrapTable.LOCALES = [];
392
+
393
+ BootstrapTable.LOCALES['en-US'] = BootstrapTable.LOCALES['en'] = {
394
+ formatLoadingMessage: function () {
395
+ return 'Loading, please wait...';
396
+ },
397
+ formatRecordsPerPage: function (pageNumber) {
398
+ return sprintf('%s records per page', pageNumber);
399
+ },
400
+ formatShowingRows: function (pageFrom, pageTo, totalRows) {
401
+ return sprintf('Showing %s to %s of %s rows', pageFrom, pageTo, totalRows);
402
+ },
403
+ formatSearch: function () {
404
+ return 'Search';
405
+ },
406
+ formatNoMatches: function () {
407
+ return 'No matching records found';
408
+ },
409
+ formatPaginationSwitch: function () {
410
+ return 'Hide/Show pagination';
411
+ },
412
+ formatRefresh: function () {
413
+ return 'Refresh';
414
+ },
415
+ formatToggle: function () {
416
+ return 'Toggle';
417
+ },
418
+ formatColumns: function () {
419
+ return 'Columns';
420
+ },
421
+ formatAllRows: function () {
422
+ return 'All';
423
+ }
424
+ };
425
+
426
+ $.extend(BootstrapTable.DEFAULTS, BootstrapTable.LOCALES['en-US']);
427
+
428
+ BootstrapTable.COLUMN_DEFAULTS = {
429
+ radio: false,
430
+ checkbox: false,
431
+ checkboxEnabled: true,
432
+ field: undefined,
433
+ title: undefined,
434
+ titleTooltip: undefined,
435
+ 'class': undefined,
436
+ align: undefined, // left, right, center
437
+ halign: undefined, // left, right, center
438
+ falign: undefined, // left, right, center
439
+ valign: undefined, // top, middle, bottom
440
+ width: undefined,
441
+ sortable: false,
442
+ order: 'asc', // asc, desc
443
+ visible: true,
444
+ switchable: true,
445
+ clickToSelect: true,
446
+ formatter: undefined,
447
+ footerFormatter: undefined,
448
+ events: undefined,
449
+ sorter: undefined,
450
+ sortName: undefined,
451
+ cellStyle: undefined,
452
+ searchable: true,
453
+ cardVisible: true
454
+ };
455
+
456
+ BootstrapTable.EVENTS = {
457
+ 'all.bs.table': 'onAll',
458
+ 'click-cell.bs.table': 'onClickCell',
459
+ 'dbl-click-cell.bs.table': 'onDblClickCell',
460
+ 'click-row.bs.table': 'onClickRow',
461
+ 'dbl-click-row.bs.table': 'onDblClickRow',
462
+ 'sort.bs.table': 'onSort',
463
+ 'check.bs.table': 'onCheck',
464
+ 'uncheck.bs.table': 'onUncheck',
465
+ 'check-all.bs.table': 'onCheckAll',
466
+ 'uncheck-all.bs.table': 'onUncheckAll',
467
+ 'check-some.bs.table': 'onCheckSome',
468
+ 'uncheck-some.bs.table': 'onUncheckSome',
469
+ 'load-success.bs.table': 'onLoadSuccess',
470
+ 'load-error.bs.table': 'onLoadError',
471
+ 'column-switch.bs.table': 'onColumnSwitch',
472
+ 'page-change.bs.table': 'onPageChange',
473
+ 'search.bs.table': 'onSearch',
474
+ 'toggle.bs.table': 'onToggle',
475
+ 'pre-body.bs.table': 'onPreBody',
476
+ 'post-body.bs.table': 'onPostBody',
477
+ 'post-header.bs.table': 'onPostHeader',
478
+ 'expand-row.bs.table': 'onExpandRow',
479
+ 'collapse-row.bs.table': 'onCollapseRow',
480
+ 'refresh-options.bs.table': 'onRefreshOptions',
481
+ 'reset-view.bs.table': 'onResetView'
482
+ };
483
+
484
+ BootstrapTable.prototype.init = function () {
485
+ this.initLocale();
486
+ this.initContainer();
487
+ this.initTable();
488
+ this.initHeader();
489
+ this.initData();
490
+ this.initFooter();
491
+ this.initToolbar();
492
+ this.initPagination();
493
+ this.initBody();
494
+ this.initServer();
495
+ };
496
+
497
+ BootstrapTable.prototype.initLocale = function () {
498
+ if (this.options.locale) {
499
+ var parts = this.options.locale.split(/-|_/);
500
+ parts[0].toLowerCase();
501
+ parts[1] && parts[1].toUpperCase();
502
+ if ($.fn.bootstrapTable.locales[this.options.locale]) {
503
+ // locale as requested
504
+ $.extend(this.options, $.fn.bootstrapTable.locales[this.options.locale]);
505
+ } else if ($.fn.bootstrapTable.locales[parts.join('-')]) {
506
+ // locale with sep set to - (in case original was specified with _)
507
+ $.extend(this.options, $.fn.bootstrapTable.locales[parts.join('-')]);
508
+ } else if ($.fn.bootstrapTable.locales[parts[0]]) {
509
+ // short locale language code (i.e. 'en')
510
+ $.extend(this.options, $.fn.bootstrapTable.locales[parts[0]]);
511
+ }
512
+ }
513
+ };
514
+
515
+ BootstrapTable.prototype.initContainer = function () {
516
+ this.$container = $([
517
+ '<div class="bootstrap-table">',
518
+ '<div class="fixed-table-toolbar"></div>',
519
+ this.options.paginationVAlign === 'top' || this.options.paginationVAlign === 'both' ?
520
+ '<div class="fixed-table-pagination" style="clear: both;"></div>' :
521
+ '',
522
+ '<div class="fixed-table-container">',
523
+ '<div class="fixed-table-header"><table></table></div>',
524
+ '<div class="fixed-table-body">',
525
+ '<div class="fixed-table-loading">',
526
+ this.options.formatLoadingMessage(),
527
+ '</div>',
528
+ '</div>',
529
+ '<div class="fixed-table-footer"><table><tr></tr></table></div>',
530
+ this.options.paginationVAlign === 'bottom' || this.options.paginationVAlign === 'both' ?
531
+ '<div class="fixed-table-pagination"></div>' :
532
+ '',
533
+ '</div>',
534
+ '</div>'
535
+ ].join(''));
536
+
537
+ this.$container.insertAfter(this.$el);
538
+ this.$tableContainer = this.$container.find('.fixed-table-container');
539
+ this.$tableHeader = this.$container.find('.fixed-table-header');
540
+ this.$tableBody = this.$container.find('.fixed-table-body');
541
+ this.$tableLoading = this.$container.find('.fixed-table-loading');
542
+ this.$tableFooter = this.$container.find('.fixed-table-footer');
543
+ this.$toolbar = this.$container.find('.fixed-table-toolbar');
544
+ this.$pagination = this.$container.find('.fixed-table-pagination');
545
+
546
+ this.$tableBody.append(this.$el);
547
+ this.$container.after('<div class="clearfix"></div>');
548
+
549
+ this.$el.addClass(this.options.classes);
550
+ if (this.options.striped) {
551
+ this.$el.addClass('table-striped');
552
+ }
553
+ if ($.inArray('table-no-bordered', this.options.classes.split(' ')) !== -1) {
554
+ this.$tableContainer.addClass('table-no-bordered');
555
+ }
556
+ };
557
+
558
+ BootstrapTable.prototype.initTable = function () {
559
+ var that = this,
560
+ columns = [],
561
+ data = [];
562
+
563
+ this.$header = this.$el.find('thead');
564
+ if (!this.$header.length) {
565
+ this.$header = $('<thead></thead>').appendTo(this.$el);
566
+ }
567
+ this.$header.find('tr').each(function () {
568
+ var column = [];
569
+
570
+ $(this).find('th').each(function () {
571
+ column.push($.extend({}, {
572
+ title: $(this).html(),
573
+ 'class': $(this).attr('class'),
574
+ titleTooltip: $(this).attr('title'),
575
+ rowspan: $(this).attr('rowspan') ? +$(this).attr('rowspan') : undefined,
576
+ colspan: $(this).attr('colspan') ? +$(this).attr('colspan') : undefined
577
+ }, $(this).data()));
578
+ });
579
+ columns.push(column);
580
+ });
581
+ if (!$.isArray(this.options.columns[0])) {
582
+ this.options.columns = [this.options.columns];
583
+ }
584
+ this.options.columns = $.extend(true, [], columns, this.options.columns);
585
+ this.columns = [];
586
+
587
+ setFieldIndex(this.options.columns);
588
+ $.each(this.options.columns, function (i, columns) {
589
+ $.each(columns, function (j, column) {
590
+ column = $.extend({}, BootstrapTable.COLUMN_DEFAULTS, column);
591
+
592
+ if (typeof column.fieldIndex !== 'undefined') {
593
+ that.columns[column.fieldIndex] = column;
594
+ }
595
+
596
+ that.options.columns[i][j] = column;
597
+ });
598
+ });
599
+
600
+ // if options.data is setting, do not process tbody data
601
+ if (this.options.data.length) {
602
+ return;
603
+ }
604
+
605
+ this.$el.find('tbody tr').each(function () {
606
+ var row = {};
607
+
608
+ // save tr's id, class and data-* attributes
609
+ row._id = $(this).attr('id');
610
+ row._class = $(this).attr('class');
611
+ row._data = getRealDataAttr($(this).data());
612
+
613
+ $(this).find('td').each(function (i) {
614
+ var field = that.columns[i].field;
615
+
616
+ row[field] = $(this).html();
617
+ // save td's id, class and data-* attributes
618
+ row['_' + field + '_id'] = $(this).attr('id');
619
+ row['_' + field + '_class'] = $(this).attr('class');
620
+ row['_' + field + '_rowspan'] = $(this).attr('rowspan');
621
+ row['_' + field + '_title'] = $(this).attr('title');
622
+ row['_' + field + '_data'] = getRealDataAttr($(this).data());
623
+ });
624
+ data.push(row);
625
+ });
626
+ this.options.data = data;
627
+ };
628
+
629
+ BootstrapTable.prototype.initHeader = function () {
630
+ var that = this,
631
+ visibleColumns = {},
632
+ html = [];
633
+
634
+ this.header = {
635
+ fields: [],
636
+ styles: [],
637
+ classes: [],
638
+ formatters: [],
639
+ events: [],
640
+ sorters: [],
641
+ sortNames: [],
642
+ cellStyles: [],
643
+ clickToSelects: [],
644
+ searchables: []
645
+ };
646
+
647
+ $.each(this.options.columns, function (i, columns) {
648
+ html.push('<tr>');
649
+
650
+ if (i == 0 && !that.options.cardView && that.options.detailView) {
651
+ html.push(sprintf('<th class="detail" rowspan="%s"><div class="fht-cell"></div></th>',
652
+ that.options.columns.length));
653
+ }
654
+
655
+ $.each(columns, function (j, column) {
656
+ var text = '',
657
+ halign = '', // header align style
658
+ align = '', // body align style
659
+ style = '',
660
+ class_ = sprintf(' class="%s"', column['class']),
661
+ order = that.options.sortOrder || column.order,
662
+ unitWidth = 'px',
663
+ width = column.width;
664
+
665
+ if (column.width !== undefined && (!that.options.cardView)) {
666
+ if (typeof column.width === 'string') {
667
+ if (column.width.indexOf('%') !== -1) {
668
+ unitWidth = '%';
669
+ }
670
+ }
671
+ }
672
+ if (column.width && typeof column.width === 'string') {
673
+ width = column.width.replace('%', '').replace('px', '');
674
+ }
675
+
676
+ halign = sprintf('text-align: %s; ', column.halign ? column.halign : column.align);
677
+ align = sprintf('text-align: %s; ', column.align);
678
+ style = sprintf('vertical-align: %s; ', column.valign);
679
+ style += sprintf('width: %s%s; ', column.checkbox || column.radio ? 36 : width, unitWidth);
680
+
681
+ if (typeof column.fieldIndex !== 'undefined') {
682
+ that.header.fields[column.fieldIndex] = column.field;
683
+ that.header.styles[column.fieldIndex] = align + style;
684
+ that.header.classes[column.fieldIndex] = class_;
685
+ that.header.formatters[column.fieldIndex] = column.formatter;
686
+ that.header.events[column.fieldIndex] = column.events;
687
+ that.header.sorters[column.fieldIndex] = column.sorter;
688
+ that.header.sortNames[column.fieldIndex] = column.sortName;
689
+ that.header.cellStyles[column.fieldIndex] = column.cellStyle;
690
+ that.header.clickToSelects[column.fieldIndex] = column.clickToSelect;
691
+ that.header.searchables[column.fieldIndex] = column.searchable;
692
+
693
+ if (!column.visible) {
694
+ return;
695
+ }
696
+
697
+ if (that.options.cardView && (!column.cardVisible)) {
698
+ return;
699
+ }
700
+
701
+ visibleColumns[column.field] = column;
702
+ }
703
+
704
+ html.push('<th' + sprintf(' title="%s"', column.titleTooltip),
705
+ column.checkbox || column.radio ?
706
+ sprintf(' class="bs-checkbox %s"', column['class'] || '') :
707
+ class_,
708
+ sprintf(' style="%s"', halign + style),
709
+ sprintf(' rowspan="%s"', column.rowspan),
710
+ sprintf(' colspan="%s"', column.colspan),
711
+ sprintf(' data-field="%s"', column.field),
712
+ '>');
713
+
714
+ html.push(sprintf('<div class="th-inner %s">', that.options.sortable && column.sortable ?
715
+ 'sortable both' : ''));
716
+
717
+ text = column.title;
718
+
719
+ if (column.checkbox) {
720
+ if (!that.options.singleSelect && that.options.checkboxHeader) {
721
+ text = '<input name="btSelectAll" type="checkbox" />';
722
+ }
723
+ that.header.stateField = column.field;
724
+ }
725
+ if (column.radio) {
726
+ text = '';
727
+ that.header.stateField = column.field;
728
+ that.options.singleSelect = true;
729
+ }
730
+
731
+ html.push(text);
732
+ html.push('</div>');
733
+ html.push('<div class="fht-cell"></div>');
734
+ html.push('</div>');
735
+ html.push('</th>');
736
+ });
737
+ html.push('</tr>');
738
+ });
739
+
740
+ this.$header.html(html.join(''));
741
+ this.$header.find('th[data-field]').each(function (i) {
742
+ $(this).data(visibleColumns[$(this).data('field')]);
743
+ });
744
+ this.$container.off('click', '.th-inner').on('click', '.th-inner', function (event) {
745
+ if (that.options.sortable && $(this).parent().data().sortable) {
746
+ that.onSort(event);
747
+ }
748
+ });
749
+
750
+ if (!this.options.showHeader || this.options.cardView) {
751
+ this.$header.hide();
752
+ this.$tableHeader.hide();
753
+ this.$tableLoading.css('top', 0);
754
+ } else {
755
+ this.$header.show();
756
+ this.$tableHeader.show();
757
+ this.$tableLoading.css('top', this.$header.outerHeight() + 1);
758
+ // Assign the correct sortable arrow
759
+ this.getCaret();
760
+ }
761
+
762
+ this.$selectAll = this.$header.find('[name="btSelectAll"]');
763
+ this.$container.off('click', '[name="btSelectAll"]')
764
+ .on('click', '[name="btSelectAll"]', function () {
765
+ var checked = $(this).prop('checked');
766
+ that[checked ? 'checkAll' : 'uncheckAll']();
767
+ });
768
+ };
769
+
770
+ BootstrapTable.prototype.initFooter = function () {
771
+ if (!this.options.showFooter || this.options.cardView) {
772
+ this.$tableFooter.hide();
773
+ } else {
774
+ this.$tableFooter.show();
775
+ }
776
+ };
777
+
778
+ /**
779
+ * @param data
780
+ * @param type: append / prepend
781
+ */
782
+ BootstrapTable.prototype.initData = function (data, type) {
783
+ if (type === 'append') {
784
+ this.data = this.data.concat(data);
785
+ } else if (type === 'prepend') {
786
+ this.data = [].concat(data).concat(this.data);
787
+ } else {
788
+ this.data = data || this.options.data;
789
+ }
790
+
791
+ // Fix #839 Records deleted when adding new row on filtered table
792
+ if (type === 'append') {
793
+ this.options.data = this.options.data.concat(data);
794
+ } else if (type === 'prepend') {
795
+ this.options.data = [].concat(data).concat(this.options.data);
796
+ } else {
797
+ this.options.data = this.data;
798
+ }
799
+
800
+ if (this.options.sidePagination === 'server') {
801
+ return;
802
+ }
803
+ this.initSort();
804
+ };
805
+
806
+ BootstrapTable.prototype.initSort = function () {
807
+ var that = this,
808
+ name = this.options.sortName,
809
+ order = this.options.sortOrder === 'desc' ? -1 : 1,
810
+ index = $.inArray(this.options.sortName, this.header.fields);
811
+
812
+ if (index !== -1) {
813
+ this.data.sort(function (a, b) {
814
+ if (that.header.sortNames[index]) {
815
+ name = that.header.sortNames[index];
816
+ }
817
+ var aa = a[name],
818
+ bb = b[name],
819
+ value = calculateObjectValue(that.header, that.header.sorters[index], [aa, bb]);
820
+
821
+ if (value !== undefined) {
822
+ return order * value;
823
+ }
824
+
825
+ // Fix #161: undefined or null string sort bug.
826
+ if (aa === undefined || aa === null) {
827
+ aa = '';
828
+ }
829
+ if (bb === undefined || bb === null) {
830
+ bb = '';
831
+ }
832
+
833
+ // IF both values are numeric, do a numeric comparison
834
+ if ($.isNumeric(aa) && $.isNumeric(bb)) {
835
+ // Convert numerical values form string to float.
836
+ aa = parseFloat(aa);
837
+ bb = parseFloat(bb);
838
+ if (aa < bb) {
839
+ return order * -1;
840
+ }
841
+ return order;
842
+ }
843
+
844
+ if (aa === bb) {
845
+ return 0;
846
+ }
847
+
848
+ // If value is not a string, convert to string
849
+ if (typeof aa !== 'string') {
850
+ aa = aa.toString();
851
+ }
852
+
853
+ if (aa.localeCompare(bb) === -1) {
854
+ return order * -1;
855
+ }
856
+
857
+ return order;
858
+ });
859
+ }
860
+ };
861
+
862
+ BootstrapTable.prototype.onSort = function (event) {
863
+ var $this = $(event.currentTarget).parent(),
864
+ $this_ = this.$header.find('th').eq($this.index());
865
+
866
+ this.$header.add(this.$header_).find('span.order').remove();
867
+
868
+ if (this.options.sortName === $this.data('field')) {
869
+ this.options.sortOrder = this.options.sortOrder === 'asc' ? 'desc' : 'asc';
870
+ } else {
871
+ this.options.sortName = $this.data('field');
872
+ this.options.sortOrder = $this.data('order') === 'asc' ? 'desc' : 'asc';
873
+ }
874
+ this.trigger('sort', this.options.sortName, this.options.sortOrder);
875
+
876
+ $this.add($this_).data('order', this.options.sortOrder);
877
+
878
+ // Assign the correct sortable arrow
879
+ this.getCaret();
880
+
881
+ if (this.options.sidePagination === 'server') {
882
+ this.initServer();
883
+ return;
884
+ }
885
+
886
+ this.initSort();
887
+ this.initBody();
888
+ };
889
+
890
+ BootstrapTable.prototype.initToolbar = function () {
891
+ var that = this,
892
+ html = [],
893
+ timeoutId = 0,
894
+ $keepOpen,
895
+ $search,
896
+ switchableCount = 0;
897
+
898
+ this.$toolbar.html('');
899
+
900
+ if (typeof this.options.toolbar === 'string') {
901
+ $(sprintf('<div class="bars pull-%s"></div>', this.options.toolbarAlign))
902
+ .appendTo(this.$toolbar)
903
+ .append($(this.options.toolbar));
904
+ }
905
+
906
+ // showColumns, showToggle, showRefresh
907
+ html = [sprintf('<div class="columns columns-%s pull-%s">',
908
+ this.options.buttonsAlign, this.options.buttonsAlign)];
909
+
910
+ if (typeof this.options.icons === 'string') {
911
+ this.options.icons = calculateObjectValue(null, this.options.icons);
912
+ }
913
+
914
+ if (this.options.showPaginationSwitch) {
915
+ html.push(sprintf('<button class="btn btn-default" type="button" name="paginationSwitch" title="%s">',
916
+ this.options.formatPaginationSwitch()),
917
+ sprintf('<i class="%s %s"></i>', this.options.iconsPrefix, this.options.icons.paginationSwitchDown),
918
+ '</button>');
919
+ }
920
+
921
+ if (this.options.showRefresh) {
922
+ html.push(sprintf('<button class="btn btn-default' + (this.options.iconSize === undefined ? '' : ' btn-' + this.options.iconSize) + '" type="button" name="refresh" title="%s">',
923
+ this.options.formatRefresh()),
924
+ sprintf('<i class="%s %s"></i>', this.options.iconsPrefix, this.options.icons.refresh),
925
+ '</button>');
926
+ }
927
+
928
+ if (this.options.showToggle) {
929
+ html.push(sprintf('<button class="btn btn-default' + (this.options.iconSize === undefined ? '' : ' btn-' + this.options.iconSize) + '" type="button" name="toggle" title="%s">',
930
+ this.options.formatToggle()),
931
+ sprintf('<i class="%s %s"></i>', this.options.iconsPrefix, this.options.icons.toggle),
932
+ '</button>');
933
+ }
934
+
935
+ if (this.options.showColumns) {
936
+ html.push(sprintf('<div class="keep-open btn-group" title="%s">',
937
+ this.options.formatColumns()),
938
+ '<button type="button" class="btn btn-default' + (this.options.iconSize == undefined ? '' : ' btn-' + this.options.iconSize) + ' dropdown-toggle" data-toggle="dropdown">',
939
+ sprintf('<i class="%s %s"></i>', this.options.iconsPrefix, this.options.icons.columns),
940
+ ' <span class="caret"></span>',
941
+ '</button>',
942
+ '<ul class="dropdown-menu" role="menu">');
943
+
944
+ $.each(this.columns, function (i, column) {
945
+ if (column.radio || column.checkbox) {
946
+ return;
947
+ }
948
+
949
+ if (that.options.cardView && (!column.cardVisible)) {
950
+ return;
951
+ }
952
+
953
+ var checked = column.visible ? ' checked="checked"' : '';
954
+
955
+ if (column.switchable) {
956
+ html.push(sprintf('<li>' +
957
+ '<label><input type="checkbox" data-field="%s" value="%s"%s> %s</label>' +
958
+ '</li>', column.field, i, checked, column.title));
959
+ switchableCount++;
960
+ }
961
+ });
962
+ html.push('</ul>',
963
+ '</div>');
964
+ }
965
+
966
+ html.push('</div>');
967
+
968
+ // Fix #188: this.showToolbar is for extentions
969
+ if (this.showToolbar || html.length > 2) {
970
+ this.$toolbar.append(html.join(''));
971
+ }
972
+
973
+ if (this.options.showPaginationSwitch) {
974
+ this.$toolbar.find('button[name="paginationSwitch"]')
975
+ .off('click').on('click', $.proxy(this.togglePagination, this));
976
+ }
977
+
978
+ if (this.options.showRefresh) {
979
+ this.$toolbar.find('button[name="refresh"]')
980
+ .off('click').on('click', $.proxy(this.refresh, this));
981
+ }
982
+
983
+ if (this.options.showToggle) {
984
+ this.$toolbar.find('button[name="toggle"]')
985
+ .off('click').on('click', function () {
986
+ that.toggleView();
987
+ });
988
+ }
989
+
990
+ if (this.options.showColumns) {
991
+ $keepOpen = this.$toolbar.find('.keep-open');
992
+
993
+ if (switchableCount <= this.options.minimumCountColumns) {
994
+ $keepOpen.find('input').prop('disabled', true);
995
+ }
996
+
997
+ $keepOpen.find('li').off('click').on('click', function (event) {
998
+ event.stopImmediatePropagation();
999
+ });
1000
+ $keepOpen.find('input').off('click').on('click', function () {
1001
+ var $this = $(this);
1002
+
1003
+ that.toggleColumn(getFieldIndex(that.columns,
1004
+ $(this).data('field')), $this.prop('checked'), false);
1005
+ that.trigger('column-switch', $(this).data('field'), $this.prop('checked'));
1006
+ });
1007
+ }
1008
+
1009
+ if (this.options.search) {
1010
+ html = [];
1011
+ html.push(
1012
+ '<div class="pull-' + this.options.searchAlign + ' search">',
1013
+ sprintf('<input class="form-control' + (this.options.iconSize === undefined ? '' : ' input-' + this.options.iconSize) + '" type="text" placeholder="%s">',
1014
+ this.options.formatSearch()),
1015
+ '</div>');
1016
+
1017
+ this.$toolbar.append(html.join(''));
1018
+ $search = this.$toolbar.find('.search input');
1019
+ $search.off('keyup drop').on('keyup drop', function (event) {
1020
+ clearTimeout(timeoutId); // doesn't matter if it's 0
1021
+ timeoutId = setTimeout(function () {
1022
+ that.onSearch(event);
1023
+ }, that.options.searchTimeOut);
1024
+ });
1025
+
1026
+ if (this.options.searchText !== '') {
1027
+ $search.val(this.options.searchText);
1028
+ clearTimeout(timeoutId); // doesn't matter if it's 0
1029
+ timeoutId = setTimeout(function () {
1030
+ $search.trigger('keyup');
1031
+ }, that.options.searchTimeOut);
1032
+ }
1033
+ }
1034
+ };
1035
+
1036
+ BootstrapTable.prototype.onSearch = function (event) {
1037
+ var text = $.trim($(event.currentTarget).val());
1038
+
1039
+ // trim search input
1040
+ if (this.options.trimOnSearch && $(event.currentTarget).val() !== text) {
1041
+ $(event.currentTarget).val(text);
1042
+ }
1043
+
1044
+ if (text === this.searchText) {
1045
+ return;
1046
+ }
1047
+ this.searchText = text;
1048
+
1049
+ this.options.pageNumber = 1;
1050
+ this.initSearch();
1051
+ this.updatePagination();
1052
+ this.trigger('search', text);
1053
+ };
1054
+
1055
+ BootstrapTable.prototype.initSearch = function () {
1056
+ var that = this;
1057
+
1058
+ if (this.options.sidePagination !== 'server') {
1059
+ var s = this.searchText && this.searchText.toLowerCase();
1060
+ var f = $.isEmptyObject(this.filterColumns) ? null : this.filterColumns;
1061
+
1062
+ // Check filter
1063
+ this.data = f ? $.grep(this.options.data, function (item, i) {
1064
+ for (var key in f) {
1065
+ if (item[key] !== f[key]) {
1066
+ return false;
1067
+ }
1068
+ }
1069
+ return true;
1070
+ }) : this.options.data;
1071
+
1072
+ this.data = s ? $.grep(this.data, function (item, i) {
1073
+ for (var key in item) {
1074
+ key = $.isNumeric(key) ? parseInt(key, 10) : key;
1075
+ var value = item[key],
1076
+ column = that.columns[getFieldIndex(that.columns, key)],
1077
+ j = $.inArray(key, that.header.fields);
1078
+
1079
+ // Fix #142: search use formated data
1080
+ value = calculateObjectValue(column,
1081
+ that.header.formatters[j], [value, item, i], value);
1082
+
1083
+ var index = $.inArray(key, that.header.fields);
1084
+ if (index !== -1 && that.header.searchables[index] && (typeof value === 'string' || typeof value === 'number')) {
1085
+ if (that.options.strictSearch) {
1086
+ if ((value + '').toLowerCase() === s) {
1087
+ return true;
1088
+ }
1089
+ } else {
1090
+ if ((value + '').toLowerCase().indexOf(s) !== -1) {
1091
+ return true;
1092
+ }
1093
+ }
1094
+ }
1095
+ }
1096
+ return false;
1097
+ }) : this.data;
1098
+ }
1099
+ };
1100
+
1101
+ BootstrapTable.prototype.initPagination = function () {
1102
+ if (!this.options.pagination) {
1103
+ this.$pagination.hide();
1104
+ return;
1105
+ } else {
1106
+ this.$pagination.show();
1107
+ }
1108
+
1109
+ var that = this,
1110
+ html = [],
1111
+ $allSelected = false,
1112
+ i, from, to,
1113
+ $pageList,
1114
+ $first, $pre,
1115
+ $next, $last,
1116
+ $number,
1117
+ data = this.getData();
1118
+
1119
+ if (this.options.sidePagination !== 'server') {
1120
+ this.options.totalRows = data.length;
1121
+ }
1122
+
1123
+ this.totalPages = 0;
1124
+ if (this.options.totalRows) {
1125
+ if (this.options.pageSize === this.options.formatAllRows()) {
1126
+ this.options.pageSize = this.options.totalRows;
1127
+ $allSelected = true;
1128
+ } else if (this.options.pageSize === this.options.totalRows) {
1129
+ // Fix #667 Table with pagination,
1130
+ // multiple pages and a search that matches to one page throws exception
1131
+ var pageLst = typeof this.options.pageList === 'string' ?
1132
+ this.options.pageList.replace('[', '').replace(']', '')
1133
+ .replace(/ /g, '').toLowerCase().split(',') : this.options.pageList;
1134
+ if (pageLst.indexOf(this.options.formatAllRows().toLowerCase()) > -1) {
1135
+ $allSelected = true;
1136
+ }
1137
+ }
1138
+
1139
+ this.totalPages = ~~((this.options.totalRows - 1) / this.options.pageSize) + 1;
1140
+
1141
+ this.options.totalPages = this.totalPages;
1142
+ }
1143
+ if (this.totalPages > 0 && this.options.pageNumber > this.totalPages) {
1144
+ this.options.pageNumber = this.totalPages;
1145
+ }
1146
+
1147
+ this.pageFrom = (this.options.pageNumber - 1) * this.options.pageSize + 1;
1148
+ this.pageTo = this.options.pageNumber * this.options.pageSize;
1149
+ if (this.pageTo > this.options.totalRows) {
1150
+ this.pageTo = this.options.totalRows;
1151
+ }
1152
+
1153
+ html.push(
1154
+ '<div class="pull-' + this.options.paginationDetailHAlign + ' pagination-detail">',
1155
+ '<span class="pagination-info">',
1156
+ this.options.formatShowingRows(this.pageFrom, this.pageTo, this.options.totalRows),
1157
+ '</span>');
1158
+
1159
+ html.push('<span class="page-list">');
1160
+
1161
+ var pageNumber = [
1162
+ sprintf('<span class="btn-group %s">',
1163
+ this.options.paginationVAlign === 'top' || this.options.paginationVAlign === 'both' ?
1164
+ 'dropdown' : 'dropup'),
1165
+ '<button type="button" class="btn btn-default ' +
1166
+ (this.options.iconSize === undefined ? '' : ' btn-' + this.options.iconSize) +
1167
+ ' dropdown-toggle" data-toggle="dropdown">',
1168
+ '<span class="page-size">',
1169
+ $allSelected ? this.options.formatAllRows() : this.options.pageSize,
1170
+ '</span>',
1171
+ ' <span class="caret"></span>',
1172
+ '</button>',
1173
+ '<ul class="dropdown-menu" role="menu">'
1174
+ ],
1175
+ pageList = this.options.pageList;
1176
+
1177
+ if (typeof this.options.pageList === 'string') {
1178
+ var list = this.options.pageList.replace('[', '').replace(']', '')
1179
+ .replace(/ /g, '').split(',');
1180
+
1181
+ pageList = [];
1182
+ $.each(list, function (i, value) {
1183
+ pageList.push(value.toUpperCase() === that.options.formatAllRows().toUpperCase() ?
1184
+ that.options.formatAllRows() : +value);
1185
+ });
1186
+ }
1187
+
1188
+ $.each(pageList, function (i, page) {
1189
+ if (!that.options.smartDisplay || i === 0 || pageList[i - 1] <= that.options.totalRows) {
1190
+ var active;
1191
+ if ($allSelected) {
1192
+ active = page === that.options.formatAllRows() ? ' class="active"' : '';
1193
+ } else {
1194
+ active = page === that.options.pageSize ? ' class="active"' : '';
1195
+ }
1196
+ pageNumber.push(sprintf('<li%s><a href="javascript:void(0)">%s</a></li>', active, page));
1197
+ }
1198
+ });
1199
+ pageNumber.push('</ul></span>');
1200
+
1201
+ html.push(this.options.formatRecordsPerPage(pageNumber.join('')));
1202
+ html.push('</span>');
1203
+
1204
+ html.push('</div>',
1205
+ '<div class="pull-' + this.options.paginationHAlign + ' pagination">',
1206
+ '<ul class="pagination' + (this.options.iconSize === undefined ? '' : ' pagination-' + this.options.iconSize) + '">',
1207
+ '<li class="page-first"><a href="javascript:void(0)">' + this.options.paginationFirstText + '</a></li>',
1208
+ '<li class="page-pre"><a href="javascript:void(0)">' + this.options.paginationPreText + '</a></li>');
1209
+
1210
+ if (this.totalPages < 5) {
1211
+ from = 1;
1212
+ to = this.totalPages;
1213
+ } else {
1214
+ from = this.options.pageNumber - 2;
1215
+ to = from + 4;
1216
+ if (from < 1) {
1217
+ from = 1;
1218
+ to = 5;
1219
+ }
1220
+ if (to > this.totalPages) {
1221
+ to = this.totalPages;
1222
+ from = to - 4;
1223
+ }
1224
+ }
1225
+ for (i = from; i <= to; i++) {
1226
+ html.push('<li class="page-number' + (i === this.options.pageNumber ? ' active' : '') + '">',
1227
+ '<a href="javascript:void(0)">', i, '</a>',
1228
+ '</li>');
1229
+ }
1230
+
1231
+ html.push(
1232
+ '<li class="page-next"><a href="javascript:void(0)">' + this.options.paginationNextText + '</a></li>',
1233
+ '<li class="page-last"><a href="javascript:void(0)">' + this.options.paginationLastText + '</a></li>',
1234
+ '</ul>',
1235
+ '</div>');
1236
+
1237
+ this.$pagination.html(html.join(''));
1238
+
1239
+ $pageList = this.$pagination.find('.page-list a');
1240
+ $first = this.$pagination.find('.page-first');
1241
+ $pre = this.$pagination.find('.page-pre');
1242
+ $next = this.$pagination.find('.page-next');
1243
+ $last = this.$pagination.find('.page-last');
1244
+ $number = this.$pagination.find('.page-number');
1245
+
1246
+ if (this.options.pageNumber <= 1) {
1247
+ $first.addClass('disabled');
1248
+ $pre.addClass('disabled');
1249
+ }
1250
+ if (this.options.pageNumber >= this.totalPages) {
1251
+ $next.addClass('disabled');
1252
+ $last.addClass('disabled');
1253
+ }
1254
+ if (this.options.smartDisplay) {
1255
+ if (this.totalPages <= 1) {
1256
+ this.$pagination.find('div.pagination').hide();
1257
+ }
1258
+ if (pageList.length < 2 || this.options.totalRows <= pageList[0]) {
1259
+ this.$pagination.find('span.page-list').hide();
1260
+ }
1261
+
1262
+ // when data is empty, hide the pagination
1263
+ this.$pagination[this.getData().length ? 'show' : 'hide']();
1264
+ }
1265
+ if ($allSelected) {
1266
+ this.options.pageSize = this.options.formatAllRows();
1267
+ }
1268
+ $pageList.off('click').on('click', $.proxy(this.onPageListChange, this));
1269
+ $first.off('click').on('click', $.proxy(this.onPageFirst, this));
1270
+ $pre.off('click').on('click', $.proxy(this.onPagePre, this));
1271
+ $next.off('click').on('click', $.proxy(this.onPageNext, this));
1272
+ $last.off('click').on('click', $.proxy(this.onPageLast, this));
1273
+ $number.off('click').on('click', $.proxy(this.onPageNumber, this));
1274
+ };
1275
+
1276
+ BootstrapTable.prototype.updatePagination = function (event) {
1277
+ // Fix #171: IE disabled button can be clicked bug.
1278
+ if (event && $(event.currentTarget).hasClass('disabled')) {
1279
+ return;
1280
+ }
1281
+
1282
+ if (!this.options.maintainSelected) {
1283
+ this.resetRows();
1284
+ }
1285
+
1286
+ this.initPagination();
1287
+ if (this.options.sidePagination === 'server') {
1288
+ this.initServer();
1289
+ } else {
1290
+ this.initBody();
1291
+ }
1292
+
1293
+ this.trigger('page-change', this.options.pageNumber, this.options.pageSize);
1294
+ };
1295
+
1296
+ BootstrapTable.prototype.onPageListChange = function (event) {
1297
+ var $this = $(event.currentTarget);
1298
+
1299
+ $this.parent().addClass('active').siblings().removeClass('active');
1300
+ this.options.pageSize = $this.text().toUpperCase() === this.options.formatAllRows().toUpperCase() ?
1301
+ this.options.formatAllRows() : +$this.text();
1302
+ this.$toolbar.find('.page-size').text(this.options.pageSize);
1303
+
1304
+ this.updatePagination(event);
1305
+ };
1306
+
1307
+ BootstrapTable.prototype.onPageFirst = function (event) {
1308
+ this.options.pageNumber = 1;
1309
+ this.updatePagination(event);
1310
+ };
1311
+
1312
+ BootstrapTable.prototype.onPagePre = function (event) {
1313
+ this.options.pageNumber--;
1314
+ this.updatePagination(event);
1315
+ };
1316
+
1317
+ BootstrapTable.prototype.onPageNext = function (event) {
1318
+ this.options.pageNumber++;
1319
+ this.updatePagination(event);
1320
+ };
1321
+
1322
+ BootstrapTable.prototype.onPageLast = function (event) {
1323
+ this.options.pageNumber = this.totalPages;
1324
+ this.updatePagination(event);
1325
+ };
1326
+
1327
+ BootstrapTable.prototype.onPageNumber = function (event) {
1328
+ if (this.options.pageNumber === +$(event.currentTarget).text()) {
1329
+ return;
1330
+ }
1331
+ this.options.pageNumber = +$(event.currentTarget).text();
1332
+ this.updatePagination(event);
1333
+ };
1334
+
1335
+ BootstrapTable.prototype.initBody = function (fixedScroll) {
1336
+ var that = this,
1337
+ html = [],
1338
+ data = this.getData();
1339
+
1340
+ this.trigger('pre-body', data);
1341
+
1342
+ this.$body = this.$el.find('tbody');
1343
+ if (!this.$body.length) {
1344
+ this.$body = $('<tbody></tbody>').appendTo(this.$el);
1345
+ }
1346
+
1347
+ //Fix #389 Bootstrap-table-flatJSON is not working
1348
+
1349
+ if (!this.options.pagination || this.options.sidePagination === 'server') {
1350
+ this.pageFrom = 1;
1351
+ this.pageTo = data.length;
1352
+ }
1353
+
1354
+ for (var i = this.pageFrom - 1; i < this.pageTo; i++) {
1355
+ var key,
1356
+ item = data[i],
1357
+ style = {},
1358
+ csses = [],
1359
+ data_ = '',
1360
+ attributes = {},
1361
+ htmlAttributes = [];
1362
+
1363
+ style = calculateObjectValue(this.options, this.options.rowStyle, [item, i], style);
1364
+
1365
+ if (style && style.css) {
1366
+ for (key in style.css) {
1367
+ csses.push(key + ': ' + style.css[key]);
1368
+ }
1369
+ }
1370
+
1371
+ attributes = calculateObjectValue(this.options,
1372
+ this.options.rowAttributes, [item, i], attributes);
1373
+
1374
+ if (attributes) {
1375
+ for (key in attributes) {
1376
+ htmlAttributes.push(sprintf('%s="%s"', key, escapeHTML(attributes[key])));
1377
+ }
1378
+ }
1379
+
1380
+ if (item._data && !$.isEmptyObject(item._data)) {
1381
+ $.each(item._data, function (k, v) {
1382
+ // ignore data-index
1383
+ if (k === 'index') {
1384
+ return;
1385
+ }
1386
+ data_ += sprintf(' data-%s="%s"', k, v);
1387
+ });
1388
+ }
1389
+
1390
+ html.push('<tr',
1391
+ sprintf(' %s', htmlAttributes.join(' ')),
1392
+ sprintf(' id="%s"', $.isArray(item) ? undefined : item._id),
1393
+ sprintf(' class="%s"', style.classes || ($.isArray(item) ? undefined : item._class)),
1394
+ sprintf(' data-index="%s"', i),
1395
+ sprintf(' data-uniqueid="%s"', item[this.options.uniqueId]),
1396
+ sprintf('%s', data_),
1397
+ '>'
1398
+ );
1399
+
1400
+ if (this.options.cardView) {
1401
+ html.push(sprintf('<td colspan="%s">', this.header.fields.length));
1402
+ }
1403
+
1404
+ if (!this.options.cardView && this.options.detailView) {
1405
+ html.push('<td>',
1406
+ '<a class="detail-icon" href="javascript:">',
1407
+ sprintf('<i class="%s %s"></i>', this.options.iconsPrefix, this.options.icons.detailOpen),
1408
+ '</a>',
1409
+ '</td>');
1410
+ }
1411
+
1412
+ $.each(this.header.fields, function (j, field) {
1413
+ var text = '',
1414
+ value = item[field],
1415
+ type = '',
1416
+ cellStyle = {},
1417
+ id_ = '',
1418
+ class_ = that.header.classes[j],
1419
+ data_ = '',
1420
+ rowspan_ = '',
1421
+ title_ = '',
1422
+ column = that.columns[getFieldIndex(that.columns, field)];
1423
+
1424
+ if (!column.visible) {
1425
+ return;
1426
+ }
1427
+
1428
+ style = sprintf('style="%s"', csses.concat(that.header.styles[j]).join('; '));
1429
+
1430
+ value = calculateObjectValue(column,
1431
+ that.header.formatters[j], [value, item, i], value);
1432
+
1433
+ // handle td's id and class
1434
+ if (item['_' + field + '_id']) {
1435
+ id_ = sprintf(' id="%s"', item['_' + field + '_id']);
1436
+ }
1437
+ if (item['_' + field + '_class']) {
1438
+ class_ = sprintf(' class="%s"', item['_' + field + '_class']);
1439
+ }
1440
+ if (item['_' + field + '_rowspan']) {
1441
+ rowspan_ = sprintf(' rowspan="%s"', item['_' + field + '_rowspan']);
1442
+ }
1443
+ if (item['_' + field + '_title']) {
1444
+ title_ = sprintf(' title="%s"', item['_' + field + '_title']);
1445
+ }
1446
+ cellStyle = calculateObjectValue(that.header,
1447
+ that.header.cellStyles[j], [value, item, i], cellStyle);
1448
+ if (cellStyle.classes) {
1449
+ class_ = sprintf(' class="%s"', cellStyle.classes);
1450
+ }
1451
+ if (cellStyle.css) {
1452
+ var csses_ = [];
1453
+ for (var key in cellStyle.css) {
1454
+ csses_.push(key + ': ' + cellStyle.css[key]);
1455
+ }
1456
+ style = sprintf('style="%s"', csses_.concat(that.header.styles[j]).join('; '));
1457
+ }
1458
+
1459
+ if (item['_' + field + '_data'] && !$.isEmptyObject(item['_' + field + '_data'])) {
1460
+ $.each(item['_' + field + '_data'], function (k, v) {
1461
+ // ignore data-index
1462
+ if (k === 'index') {
1463
+ return;
1464
+ }
1465
+ data_ += sprintf(' data-%s="%s"', k, v);
1466
+ });
1467
+ }
1468
+
1469
+ if (column.checkbox || column.radio) {
1470
+ type = column.checkbox ? 'checkbox' : type;
1471
+ type = column.radio ? 'radio' : type;
1472
+
1473
+ text = [that.options.cardView ?
1474
+ '<div class="card-view">' : '<td class="bs-checkbox">',
1475
+ '<input' +
1476
+ sprintf(' data-index="%s"', i) +
1477
+ sprintf(' name="%s"', that.options.selectItemName) +
1478
+ sprintf(' type="%s"', type) +
1479
+ sprintf(' value="%s"', item[that.options.idField]) +
1480
+ sprintf(' checked="%s"', value === true ||
1481
+ (value && value.checked) ? 'checked' : undefined) +
1482
+ sprintf(' disabled="%s"', !column.checkboxEnabled ||
1483
+ (value && value.disabled) ? 'disabled' : undefined) +
1484
+ ' />',
1485
+ that.options.cardView ? '</div>' : '</td>'
1486
+ ].join('');
1487
+
1488
+ item[that.header.stateField] = value === true || (value && value.checked);
1489
+ } else {
1490
+ value = typeof value === 'undefined' || value === null ?
1491
+ that.options.undefinedText : value;
1492
+
1493
+ text = that.options.cardView ? ['<div class="card-view">',
1494
+ that.options.showHeader ? sprintf('<span class="title" %s>%s</span>', style,
1495
+ getPropertyFromOther(that.columns, 'field', 'title', field)) : '',
1496
+ sprintf('<span class="value">%s</span>', value),
1497
+ '</div>'
1498
+ ].join('') : [sprintf('<td%s %s %s %s %s %s>', id_, class_, style, data_, rowspan_, title_),
1499
+ value,
1500
+ '</td>'
1501
+ ].join('');
1502
+
1503
+ // Hide empty data on Card view when smartDisplay is set to true.
1504
+ if (that.options.cardView && that.options.smartDisplay && value === '') {
1505
+ text = '';
1506
+ }
1507
+ }
1508
+
1509
+ html.push(text);
1510
+ });
1511
+
1512
+ if (this.options.cardView) {
1513
+ html.push('</td>');
1514
+ }
1515
+
1516
+ html.push('</tr>');
1517
+ }
1518
+
1519
+ // show no records
1520
+ if (!html.length) {
1521
+ html.push('<tr class="no-records-found">',
1522
+ sprintf('<td colspan="%s">%s</td>',
1523
+ this.$header.find('th').length, this.options.formatNoMatches()),
1524
+ '</tr>');
1525
+ }
1526
+
1527
+ this.$body.html(html.join(''));
1528
+
1529
+ if (!fixedScroll) {
1530
+ this.scrollTo(0);
1531
+ }
1532
+
1533
+ // click to select by column
1534
+ this.$body.find('> tr[data-index] > td').off('click dblclick').on('click dblclick', function (e) {
1535
+ var $td = $(this),
1536
+ $tr = $td.parent(),
1537
+ item = that.data[$tr.data('index')],
1538
+ cellIndex = $td[0].cellIndex,
1539
+ $headerCell = that.$header.find('th:eq(' + cellIndex + ')'),
1540
+ field = $headerCell.data('field'),
1541
+ value = item[field];
1542
+
1543
+ that.trigger(e.type === 'click' ? 'click-cell' : 'dbl-click-cell', field, value, item, $td);
1544
+ that.trigger(e.type === 'click' ? 'click-row' : 'dbl-click-row', item, $tr);
1545
+ // if click to select - then trigger the checkbox/radio click
1546
+ if (e.type === 'click' && that.options.clickToSelect) {
1547
+ if (that.header.clickToSelects[$tr.children().index($(this))]) {
1548
+ var $selectItem = $tr.find(sprintf('[name="%s"]', that.options.selectItemName));
1549
+ if ($selectItem.length) {
1550
+ $selectItem[0].click(); // #144: .trigger('click') bug
1551
+ }
1552
+ }
1553
+ }
1554
+ });
1555
+
1556
+ this.$body.find('> tr[data-index] > td > .detail-icon').off('click').on('click', function () {
1557
+ var $this = $(this),
1558
+ $tr = $this.parent().parent(),
1559
+ index = $tr.data('index'),
1560
+ row = data[index]; // Fix #980 Detail view, when searching, returns wrong row
1561
+
1562
+ // remove and update
1563
+ if ($tr.next().is('tr.detail-view')) {
1564
+ $this.find('i').attr('class', sprintf('%s %s', that.options.iconsPrefix, that.options.icons.detailOpen));
1565
+ $tr.next().remove();
1566
+ that.trigger('collapse-row', index, row);
1567
+ } else {
1568
+ $this.find('i').attr('class', sprintf('%s %s', that.options.iconsPrefix, that.options.icons.detailClose));
1569
+ $tr.after(sprintf('<tr class="detail-view"><td colspan="%s">%s</td></tr>',
1570
+ $tr.find('td').length, calculateObjectValue(that.options,
1571
+ that.options.detailFormatter, [index, row], '')));
1572
+ that.trigger('expand-row', index, row, $tr.next().find('td'));
1573
+ }
1574
+ that.resetView();
1575
+ });
1576
+
1577
+ this.$selectItem = this.$body.find(sprintf('[name="%s"]', this.options.selectItemName));
1578
+ this.$selectItem.off('click').on('click', function (event) {
1579
+ event.stopImmediatePropagation();
1580
+
1581
+ var checked = $(this).prop('checked'),
1582
+ row = that.data[$(this).data('index')];
1583
+
1584
+ row[that.header.stateField] = checked;
1585
+
1586
+ if (that.options.singleSelect) {
1587
+ that.$selectItem.not(this).each(function () {
1588
+ that.data[$(this).data('index')][that.header.stateField] = false;
1589
+ });
1590
+ that.$selectItem.filter(':checked').not(this).prop('checked', false);
1591
+ }
1592
+
1593
+ that.updateSelected();
1594
+ that.trigger(checked ? 'check' : 'uncheck', row);
1595
+ });
1596
+
1597
+ $.each(this.header.events, function (i, events) {
1598
+ if (!events) {
1599
+ return;
1600
+ }
1601
+ // fix bug, if events is defined with namespace
1602
+ if (typeof events === 'string') {
1603
+ events = calculateObjectValue(null, events);
1604
+ }
1605
+
1606
+ var field = that.header.fields[i],
1607
+ fieldIndex = $.inArray(field, that.getVisibleFields());
1608
+
1609
+ if (that.options.detailView && !that.options.cardView) {
1610
+ fieldIndex += 1;
1611
+ }
1612
+
1613
+ for (var key in events) {
1614
+ that.$body.find('tr').each(function () {
1615
+ var $tr = $(this),
1616
+ $td = $tr.find(that.options.cardView ? '.card-view' : 'td').eq(fieldIndex),
1617
+ index = key.indexOf(' '),
1618
+ name = key.substring(0, index),
1619
+ el = key.substring(index + 1),
1620
+ func = events[key];
1621
+
1622
+ $td.find(el).off(name).on(name, function (e) {
1623
+ var index = $tr.data('index'),
1624
+ row = that.data[index],
1625
+ value = row[field];
1626
+
1627
+ func.apply(this, [e, value, row, index]);
1628
+ });
1629
+ });
1630
+ }
1631
+ });
1632
+
1633
+ this.updateSelected();
1634
+ this.resetView();
1635
+
1636
+ this.trigger('post-body');
1637
+ };
1638
+
1639
+ BootstrapTable.prototype.initServer = function (silent, query) {
1640
+ var that = this,
1641
+ data = {},
1642
+ params = {
1643
+ pageSize: this.options.pageSize === this.options.formatAllRows() ?
1644
+ this.options.totalRows : this.options.pageSize,
1645
+ pageNumber: this.options.pageNumber,
1646
+ searchText: this.searchText,
1647
+ sortName: this.options.sortName,
1648
+ sortOrder: this.options.sortOrder
1649
+ },
1650
+ request;
1651
+
1652
+ if (!this.options.url && !this.options.ajax) {
1653
+ return;
1654
+ }
1655
+
1656
+ if (this.options.queryParamsType === 'limit') {
1657
+ params = {
1658
+ search: params.searchText,
1659
+ sort: params.sortName,
1660
+ order: params.sortOrder
1661
+ };
1662
+ if (this.options.pagination) {
1663
+ params.limit = this.options.pageSize === this.options.formatAllRows() ?
1664
+ this.options.totalRows : this.options.pageSize;
1665
+ params.offset = this.options.pageSize === this.options.formatAllRows() ?
1666
+ 0 : this.options.pageSize * (this.options.pageNumber - 1);
1667
+ }
1668
+ }
1669
+
1670
+ if (!($.isEmptyObject(this.filterColumnsPartial))) {
1671
+ params['filter'] = JSON.stringify(this.filterColumnsPartial, null);
1672
+ }
1673
+
1674
+ data = calculateObjectValue(this.options, this.options.queryParams, [params], data);
1675
+
1676
+ $.extend(data, query || {});
1677
+
1678
+ // false to stop request
1679
+ if (data === false) {
1680
+ return;
1681
+ }
1682
+
1683
+ if (!silent) {
1684
+ this.$tableLoading.show();
1685
+ }
1686
+ request = $.extend({}, calculateObjectValue(null, this.options.ajaxOptions), {
1687
+ type: this.options.method,
1688
+ url: this.options.url,
1689
+ data: this.options.contentType === 'application/json' && this.options.method === 'post' ?
1690
+ JSON.stringify(data) : data,
1691
+ cache: this.options.cache,
1692
+ contentType: this.options.contentType,
1693
+ dataType: this.options.dataType,
1694
+ success: function (res) {
1695
+ res = calculateObjectValue(that.options, that.options.responseHandler, [res], res);
1696
+
1697
+ that.load(res);
1698
+ that.trigger('load-success', res);
1699
+ },
1700
+ error: function (res) {
1701
+ that.trigger('load-error', res.status);
1702
+ },
1703
+ complete: function () {
1704
+ if (!silent) {
1705
+ that.$tableLoading.hide();
1706
+ }
1707
+ }
1708
+ });
1709
+
1710
+ if (this.options.ajax) {
1711
+ calculateObjectValue(this, this.options.ajax, [request], null);
1712
+ } else {
1713
+ $.ajax(request);
1714
+ }
1715
+ };
1716
+
1717
+ BootstrapTable.prototype.getCaret = function () {
1718
+ var that = this;
1719
+
1720
+ $.each(this.$header.find('th'), function (i, th) {
1721
+ $(th).find('.sortable').removeClass('desc asc').addClass($(th).data('field') === that.options.sortName ? that.options.sortOrder : 'both');
1722
+ });
1723
+ };
1724
+
1725
+ BootstrapTable.prototype.updateSelected = function () {
1726
+ var checkAll = this.$selectItem.filter(':enabled').length ===
1727
+ this.$selectItem.filter(':enabled').filter(':checked').length;
1728
+
1729
+ this.$selectAll.add(this.$selectAll_).prop('checked', checkAll);
1730
+
1731
+ this.$selectItem.each(function () {
1732
+ $(this).parents('tr')[$(this).prop('checked') ? 'addClass' : 'removeClass']('selected');
1733
+ });
1734
+ };
1735
+
1736
+ BootstrapTable.prototype.updateRows = function () {
1737
+ var that = this;
1738
+
1739
+ this.$selectItem.each(function () {
1740
+ that.data[$(this).data('index')][that.header.stateField] = $(this).prop('checked');
1741
+ });
1742
+ };
1743
+
1744
+ BootstrapTable.prototype.resetRows = function () {
1745
+ var that = this;
1746
+
1747
+ $.each(this.data, function (i, row) {
1748
+ that.$selectAll.prop('checked', false);
1749
+ that.$selectItem.prop('checked', false);
1750
+ row[that.header.stateField] = false;
1751
+ });
1752
+ };
1753
+
1754
+ BootstrapTable.prototype.trigger = function (name) {
1755
+ var args = Array.prototype.slice.call(arguments, 1);
1756
+
1757
+ name += '.bs.table';
1758
+ this.options[BootstrapTable.EVENTS[name]].apply(this.options, args);
1759
+ this.$el.trigger($.Event(name), args);
1760
+
1761
+ this.options.onAll(name, args);
1762
+ this.$el.trigger($.Event('all.bs.table'), [name, args]);
1763
+ };
1764
+
1765
+ BootstrapTable.prototype.resetHeader = function () {
1766
+ // fix #61: the hidden table reset header bug.
1767
+ // fix bug: get $el.css('width') error sometime (height = 500)
1768
+ clearTimeout(this.timeoutId_);
1769
+ this.timeoutId_ = setTimeout($.proxy(this.fitHeader, this), this.$el.is(':hidden') ? 100 : 0);
1770
+ };
1771
+
1772
+ BootstrapTable.prototype.fitHeader = function () {
1773
+ var that = this,
1774
+ fixedBody,
1775
+ scrollWidth;
1776
+
1777
+ if (that.$el.is(':hidden')) {
1778
+ that.timeoutId_ = setTimeout($.proxy(that.fitHeader, that), 100);
1779
+ return;
1780
+ }
1781
+ fixedBody = this.$tableBody.get(0);
1782
+
1783
+ scrollWidth = fixedBody.scrollWidth > fixedBody.clientWidth &&
1784
+ fixedBody.scrollHeight > fixedBody.clientHeight + this.$header.outerHeight() ?
1785
+ getScrollBarWidth() : 0;
1786
+
1787
+ this.$el.css('margin-top', -this.$header.outerHeight());
1788
+ this.$header_ = this.$header.clone(true, true);
1789
+ this.$selectAll_ = this.$header_.find('[name="btSelectAll"]');
1790
+ this.$tableHeader.css({
1791
+ 'margin-right': scrollWidth
1792
+ }).find('table').css('width', this.$el.outerWidth())
1793
+ .html('').attr('class', this.$el.attr('class'))
1794
+ .append(this.$header_);
1795
+
1796
+ // fix bug: $.data() is not working as expected after $.append()
1797
+ this.$header.find('th[data-field]').each(function (i) {
1798
+ that.$header_.find(sprintf('th[data-field="%s"]', $(this).data('field'))).data($(this).data());
1799
+ });
1800
+
1801
+ var visibleFields = this.getVisibleFields();
1802
+
1803
+ this.$body.find('tr:first-child:not(.no-records-found) > *').each(function (i) {
1804
+ var $this = $(this),
1805
+ index = i;
1806
+
1807
+ if (that.options.detailView && !that.options.cardView) {
1808
+ if (i === 0) {
1809
+ that.$header_.find('th.detail').find('.fht-cell').width($this.innerWidth());
1810
+ }
1811
+ index = i - 1;
1812
+ }
1813
+
1814
+ that.$header_.find(sprintf('th[data-field="%s"]', visibleFields[index]))
1815
+ .find('.fht-cell').width($this.innerWidth());
1816
+ });
1817
+ // horizontal scroll event
1818
+ // TODO: it's probably better improving the layout than binding to scroll event
1819
+ this.$tableBody.off('scroll').on('scroll', function () {
1820
+ that.$tableHeader.scrollLeft($(this).scrollLeft());
1821
+ });
1822
+ that.trigger('post-header');
1823
+ };
1824
+
1825
+ BootstrapTable.prototype.resetFooter = function () {
1826
+ var that = this,
1827
+ data = that.getData(),
1828
+ html = [];
1829
+
1830
+ if (!this.options.showFooter || this.options.cardView) { //do nothing
1831
+ return;
1832
+ }
1833
+
1834
+ if (!this.options.cardView && this.options.detailView) {
1835
+ html.push('<td></td>');
1836
+ }
1837
+
1838
+ $.each(this.columns, function (i, column) {
1839
+ var falign = '', // footer align style
1840
+ style = '',
1841
+ class_ = sprintf(' class="%s"', column['class']);
1842
+
1843
+ if (!column.visible) {
1844
+ return;
1845
+ }
1846
+
1847
+ if (that.options.cardView && (!column.cardVisible)) {
1848
+ return;
1849
+ }
1850
+
1851
+ falign = sprintf('text-align: %s; ', column.falign ? column.falign : column.align);
1852
+ style = sprintf('vertical-align: %s; ', column.valign);
1853
+
1854
+ html.push('<td', class_, sprintf(' style="%s"', falign + style), '>');
1855
+
1856
+ html.push(calculateObjectValue(column, column.footerFormatter, [data], '&nbsp;') || '&nbsp;');
1857
+ html.push('</td>');
1858
+ });
1859
+
1860
+ this.$tableFooter.find('tr').html(html.join(''));
1861
+ clearTimeout(this.timeoutFooter_);
1862
+ this.timeoutFooter_ = setTimeout($.proxy(this.fitFooter, this),
1863
+ this.$el.is(':hidden') ? 100 : 0);
1864
+ };
1865
+
1866
+ BootstrapTable.prototype.fitFooter = function () {
1867
+ var that = this,
1868
+ $footerTd,
1869
+ elWidth,
1870
+ scrollWidth;
1871
+
1872
+ clearTimeout(this.timeoutFooter_);
1873
+ if (this.$el.is(':hidden')) {
1874
+ this.timeoutFooter_ = setTimeout($.proxy(this.fitFooter, this), 100);
1875
+ return;
1876
+ }
1877
+
1878
+ elWidth = this.$el.css('width');
1879
+ scrollWidth = elWidth > this.$tableBody.width() ? getScrollBarWidth() : 0;
1880
+
1881
+ this.$tableFooter.css({
1882
+ 'margin-right': scrollWidth
1883
+ }).find('table').css('width', elWidth)
1884
+ .attr('class', this.$el.attr('class'));
1885
+
1886
+ $footerTd = this.$tableFooter.find('td');
1887
+
1888
+ this.$tableBody.find('tbody tr:first-child:not(.no-records-found) > td').each(function (i) {
1889
+ $footerTd.eq(i).outerWidth($(this).outerWidth());
1890
+ });
1891
+ };
1892
+
1893
+ BootstrapTable.prototype.toggleColumn = function (index, checked, needUpdate) {
1894
+ if (index === -1) {
1895
+ return;
1896
+ }
1897
+ this.columns[index].visible = checked;
1898
+ this.initHeader();
1899
+ this.initSearch();
1900
+ this.initPagination();
1901
+ this.initBody();
1902
+
1903
+ if (this.options.showColumns) {
1904
+ var $items = this.$toolbar.find('.keep-open input').prop('disabled', false);
1905
+
1906
+ if (needUpdate) {
1907
+ $items.filter(sprintf('[value="%s"]', index)).prop('checked', checked);
1908
+ }
1909
+
1910
+ if ($items.filter(':checked').length <= this.options.minimumCountColumns) {
1911
+ $items.filter(':checked').prop('disabled', true);
1912
+ }
1913
+ }
1914
+ };
1915
+
1916
+ BootstrapTable.prototype.toggleRow = function (index, isIdField, visible) {
1917
+ if (index === -1) {
1918
+ return;
1919
+ }
1920
+
1921
+ $(this.$body[0]).children().filter(sprintf(isIdField ? '[data-uniqueid="%s"]' : '[data-index="%s"]', index))[visible ? 'show' : 'hide']();
1922
+ };
1923
+
1924
+ BootstrapTable.prototype.getVisibleFields = function () {
1925
+ var that = this,
1926
+ visibleFields = [];
1927
+
1928
+ $.each(this.header.fields, function (j, field) {
1929
+ var column = that.columns[getFieldIndex(that.columns, field)];
1930
+
1931
+ if (!column.visible) {
1932
+ return;
1933
+ }
1934
+ visibleFields.push(field);
1935
+ });
1936
+ return visibleFields;
1937
+ };
1938
+
1939
+ // PUBLIC FUNCTION DEFINITION
1940
+ // =======================
1941
+
1942
+ BootstrapTable.prototype.resetView = function (params) {
1943
+ var padding = 0;
1944
+
1945
+ if (params && params.height) {
1946
+ this.options.height = params.height;
1947
+ }
1948
+
1949
+ this.$selectAll.prop('checked', this.$selectItem.length > 0 &&
1950
+ this.$selectItem.length === this.$selectItem.filter(':checked').length);
1951
+
1952
+ if (this.options.height) {
1953
+ var toolbarHeight = getRealHeight(this.$toolbar),
1954
+ paginationHeight = getRealHeight(this.$pagination),
1955
+ height = this.options.height - toolbarHeight - paginationHeight;
1956
+
1957
+ this.$tableContainer.css('height', height + 'px');
1958
+ }
1959
+
1960
+ if (this.options.cardView) {
1961
+ // remove the element css
1962
+ this.$el.css('margin-top', '0');
1963
+ this.$tableContainer.css('padding-bottom', '0');
1964
+ return;
1965
+ }
1966
+
1967
+ if (this.options.showHeader && this.options.height) {
1968
+ this.$tableHeader.show();
1969
+ this.resetHeader();
1970
+ padding += this.$header.outerHeight();
1971
+ } else {
1972
+ this.$tableHeader.hide();
1973
+ this.trigger('post-header');
1974
+ }
1975
+
1976
+ if (this.options.showFooter) {
1977
+ this.resetFooter();
1978
+ if (this.options.height) {
1979
+ padding += this.$tableFooter.outerHeight();
1980
+ }
1981
+ }
1982
+
1983
+ // Assign the correct sortable arrow
1984
+ this.getCaret();
1985
+ this.$tableContainer.css('padding-bottom', padding + 'px');
1986
+ this.trigger('reset-view');
1987
+ };
1988
+
1989
+ BootstrapTable.prototype.getData = function (useCurrentPage) {
1990
+ return (this.searchText || !$.isEmptyObject(this.filterColumns) || !$.isEmptyObject(this.filterColumnsPartial)) ?
1991
+ (useCurrentPage ? this.data.slice(this.pageFrom - 1, this.pageTo) : this.data) :
1992
+ (useCurrentPage ? this.options.data.slice(this.pageFrom - 1, this.pageTo) : this.options.data);
1993
+ };
1994
+
1995
+ BootstrapTable.prototype.load = function (data) {
1996
+ var fixedScroll = false;
1997
+
1998
+ // #431: support pagination
1999
+ if (this.options.sidePagination === 'server') {
2000
+ this.options.totalRows = data.total;
2001
+ fixedScroll = data.fixedScroll;
2002
+ data = data.rows;
2003
+ } else if (!$.isArray(data)) { // support fixedScroll
2004
+ fixedScroll = data.fixedScroll;
2005
+ data = data.data;
2006
+ }
2007
+
2008
+ this.initData(data);
2009
+ this.initSearch();
2010
+ this.initPagination();
2011
+ this.initBody(fixedScroll);
2012
+ };
2013
+
2014
+ BootstrapTable.prototype.append = function (data) {
2015
+ this.initData(data, 'append');
2016
+ this.initSearch();
2017
+ this.initPagination();
2018
+ this.initBody(true);
2019
+ };
2020
+
2021
+ BootstrapTable.prototype.prepend = function (data) {
2022
+ this.initData(data, 'prepend');
2023
+ this.initSearch();
2024
+ this.initPagination();
2025
+ this.initBody(true);
2026
+ };
2027
+
2028
+ BootstrapTable.prototype.remove = function (params) {
2029
+ var len = this.options.data.length,
2030
+ i, row;
2031
+
2032
+ if (!params.hasOwnProperty('field') || !params.hasOwnProperty('values')) {
2033
+ return;
2034
+ }
2035
+
2036
+ for (i = len - 1; i >= 0; i--) {
2037
+ row = this.options.data[i];
2038
+
2039
+ if (!row.hasOwnProperty(params.field)) {
2040
+ continue;
2041
+ }
2042
+ if ($.inArray(row[params.field], params.values) !== -1) {
2043
+ this.options.data.splice(i, 1);
2044
+ }
2045
+ }
2046
+
2047
+ if (len === this.options.data.length) {
2048
+ return;
2049
+ }
2050
+
2051
+ this.initSearch();
2052
+ this.initPagination();
2053
+ this.initBody(true);
2054
+ };
2055
+
2056
+ BootstrapTable.prototype.removeAll = function () {
2057
+ if (this.options.data.length > 0) {
2058
+ this.options.data.splice(0, this.options.data.length);
2059
+ this.initSearch();
2060
+ this.initPagination();
2061
+ this.initBody(true);
2062
+ }
2063
+ };
2064
+
2065
+ BootstrapTable.prototype.getRowByUniqueId = function (id) {
2066
+ var uniqueId = this.options.uniqueId,
2067
+ len = this.options.data.length,
2068
+ dataRow = undefined,
2069
+ i, row;
2070
+
2071
+ for (i = len - 1; i >= 0; i--) {
2072
+ row = this.options.data[i];
2073
+
2074
+ if (!row.hasOwnProperty(uniqueId)) {
2075
+ continue;
2076
+ }
2077
+
2078
+ if (typeof row[uniqueId] === 'string') {
2079
+ id = id.toString();
2080
+ } else if (typeof row[uniqueId] === 'number') {
2081
+ if ((Number(row[uniqueId]) === row[uniqueId]) && (row[uniqueId] % 1 === 0)) {
2082
+ id = parseInt(id);
2083
+ } else if ((row[uniqueId] === Number(row[uniqueId])) && (row[uniqueId] !== 0)) {
2084
+ id = parseFloat(id);
2085
+ }
2086
+ }
2087
+
2088
+ if (row[uniqueId] === id) {
2089
+ dataRow = row;
2090
+ break;
2091
+ }
2092
+ }
2093
+
2094
+ return dataRow;
2095
+ };
2096
+
2097
+ BootstrapTable.prototype.removeByUniqueId = function (id) {
2098
+ var len = this.options.data.length,
2099
+ row = this.getRowByUniqueId(id);
2100
+
2101
+ if (row) {
2102
+ this.options.data.splice(this.options.data.indexOf(row), 1);
2103
+ }
2104
+
2105
+ if (len === this.options.data.length) {
2106
+ return;
2107
+ }
2108
+
2109
+ this.initSearch();
2110
+ this.initPagination();
2111
+ this.initBody(true);
2112
+ };
2113
+
2114
+ BootstrapTable.prototype.insertRow = function (params) {
2115
+ if (!params.hasOwnProperty('index') || !params.hasOwnProperty('row')) {
2116
+ return;
2117
+ }
2118
+ this.data.splice(params.index, 0, params.row);
2119
+ this.initSearch();
2120
+ this.initPagination();
2121
+ this.initSort();
2122
+ this.initBody(true);
2123
+ };
2124
+
2125
+ BootstrapTable.prototype.updateRow = function (params) {
2126
+ if (!params.hasOwnProperty('index') || !params.hasOwnProperty('row')) {
2127
+ return;
2128
+ }
2129
+ $.extend(this.data[params.index], params.row);
2130
+ this.initSort();
2131
+ this.initBody(true);
2132
+ };
2133
+
2134
+ BootstrapTable.prototype.showRow = function (params) {
2135
+ if (!params.hasOwnProperty('index')) {
2136
+ return;
2137
+ }
2138
+
2139
+ this.toggleRow(params.index, params.isIdField === undefined ? false : true, true);
2140
+ };
2141
+
2142
+ BootstrapTable.prototype.hideRow = function (params) {
2143
+ if (!params.hasOwnProperty('index')) {
2144
+ return;
2145
+ }
2146
+
2147
+ this.toggleRow(params.index, params.isIdField === undefined ? false : true, false);
2148
+ };
2149
+
2150
+ BootstrapTable.prototype.getRowsHidden = function (show) {
2151
+ var rows = $(this.$body[0]).children().filter(':hidden'),
2152
+ i = 0;
2153
+ if (show) {
2154
+ for (; i < rows.length; i++) {
2155
+ $(rows[i]).show();
2156
+ }
2157
+ }
2158
+ return rows;
2159
+ };
2160
+
2161
+ BootstrapTable.prototype.mergeCells = function (options) {
2162
+ var row = options.index,
2163
+ col = $.inArray(options.field, this.getVisibleFields()),
2164
+ rowspan = options.rowspan || 1,
2165
+ colspan = options.colspan || 1,
2166
+ i, j,
2167
+ $tr = this.$body.find('tr'),
2168
+ $td;
2169
+
2170
+ if (this.options.detailView && !this.options.cardView) {
2171
+ col += 1;
2172
+ }
2173
+
2174
+ $td = $tr.eq(row).find('td').eq(col);
2175
+
2176
+ if (row < 0 || col < 0 || row >= this.data.length) {
2177
+ return;
2178
+ }
2179
+
2180
+ for (i = row; i < row + rowspan; i++) {
2181
+ for (j = col; j < col + colspan; j++) {
2182
+ $tr.eq(i).find('td').eq(j).hide();
2183
+ }
2184
+ }
2185
+
2186
+ $td.attr('rowspan', rowspan).attr('colspan', colspan).show();
2187
+ };
2188
+
2189
+ BootstrapTable.prototype.updateCell = function (params) {
2190
+ if (!params.hasOwnProperty('rowIndex') || !params.hasOwnProperty('fieldName') || !params.hasOwnProperty('fieldValue')) {
2191
+ return;
2192
+ }
2193
+ this.data[params.rowIndex][params.fieldName] = params.fieldValue;
2194
+ this.initSort();
2195
+ this.initBody(true);
2196
+ };
2197
+
2198
+ BootstrapTable.prototype.getOptions = function () {
2199
+ return this.options;
2200
+ };
2201
+
2202
+ BootstrapTable.prototype.getSelections = function () {
2203
+ var that = this;
2204
+
2205
+ return $.grep(this.data, function (row) {
2206
+ return row[that.header.stateField];
2207
+ });
2208
+ };
2209
+
2210
+ BootstrapTable.prototype.getAllSelections = function () {
2211
+ var that = this;
2212
+
2213
+ return $.grep(this.options.data, function (row) {
2214
+ return row[that.header.stateField];
2215
+ });
2216
+ };
2217
+
2218
+ BootstrapTable.prototype.checkAll = function () {
2219
+ this.checkAll_(true);
2220
+ };
2221
+
2222
+ BootstrapTable.prototype.uncheckAll = function () {
2223
+ this.checkAll_(false);
2224
+ };
2225
+
2226
+ BootstrapTable.prototype.checkAll_ = function (checked) {
2227
+ var rows;
2228
+ if (!checked) {
2229
+ rows = this.getSelections();
2230
+ }
2231
+ this.$selectItem.filter(':enabled').prop('checked', checked);
2232
+ this.updateRows();
2233
+ this.updateSelected();
2234
+ if (checked) {
2235
+ rows = this.getSelections();
2236
+ }
2237
+ this.trigger(checked ? 'check-all' : 'uncheck-all', rows);
2238
+ };
2239
+
2240
+ BootstrapTable.prototype.check = function (index) {
2241
+ this.check_(true, index);
2242
+ };
2243
+
2244
+ BootstrapTable.prototype.uncheck = function (index) {
2245
+ this.check_(false, index);
2246
+ };
2247
+
2248
+ BootstrapTable.prototype.check_ = function (checked, index) {
2249
+ this.$selectItem.filter(sprintf('[data-index="%s"]', index)).prop('checked', checked);
2250
+ this.data[index][this.header.stateField] = checked;
2251
+ this.updateSelected();
2252
+ this.trigger(checked ? 'check' : 'uncheck', this.data[index]);
2253
+ };
2254
+
2255
+ BootstrapTable.prototype.checkBy = function (obj) {
2256
+ this.checkBy_(true, obj);
2257
+ };
2258
+
2259
+ BootstrapTable.prototype.uncheckBy = function (obj) {
2260
+ this.checkBy_(false, obj);
2261
+ };
2262
+
2263
+ BootstrapTable.prototype.checkBy_ = function (checked, obj) {
2264
+ if (!obj.hasOwnProperty('field') || !obj.hasOwnProperty('values')) {
2265
+ return;
2266
+ }
2267
+
2268
+ var that = this,
2269
+ rows = [];
2270
+ $.each(this.options.data, function (index, row) {
2271
+ if (!row.hasOwnProperty(obj.field)) {
2272
+ return false;
2273
+ }
2274
+ if ($.inArray(row[obj.field], obj.values) !== -1) {
2275
+ that.$selectItem.filter(sprintf('[data-index="%s"]', index)).prop('checked', checked);
2276
+ row[that.header.stateField] = checked;
2277
+ rows.push(row);
2278
+ that.trigger(checked ? 'check' : 'uncheck', row);
2279
+ }
2280
+ });
2281
+ this.updateSelected();
2282
+ this.trigger(checked ? 'check-some' : 'uncheck-some', rows);
2283
+ };
2284
+
2285
+ BootstrapTable.prototype.destroy = function () {
2286
+ this.$el.insertBefore(this.$container);
2287
+ $(this.options.toolbar).insertBefore(this.$el);
2288
+ this.$container.next().remove();
2289
+ this.$container.remove();
2290
+ this.$el.html(this.$el_.html())
2291
+ .css('margin-top', '0')
2292
+ .attr('class', this.$el_.attr('class') || ''); // reset the class
2293
+ };
2294
+
2295
+ BootstrapTable.prototype.showLoading = function () {
2296
+ this.$tableLoading.show();
2297
+ };
2298
+
2299
+ BootstrapTable.prototype.hideLoading = function () {
2300
+ this.$tableLoading.hide();
2301
+ };
2302
+
2303
+ BootstrapTable.prototype.togglePagination = function () {
2304
+ this.options.pagination = !this.options.pagination;
2305
+ var button = this.$toolbar.find('button[name="paginationSwitch"] i');
2306
+ if (this.options.pagination) {
2307
+ button.attr("class", this.options.iconsPrefix + " " + this.options.icons.paginationSwitchDown);
2308
+ } else {
2309
+ button.attr("class", this.options.iconsPrefix + " " + this.options.icons.paginationSwitchUp);
2310
+ }
2311
+ this.updatePagination();
2312
+ };
2313
+
2314
+ BootstrapTable.prototype.refresh = function (params) {
2315
+ if (params && params.url) {
2316
+ this.options.url = params.url;
2317
+ this.options.pageNumber = 1;
2318
+ }
2319
+ this.initServer(params && params.silent, params && params.query);
2320
+ };
2321
+
2322
+ BootstrapTable.prototype.resetWidth = function () {
2323
+ if (this.options.showHeader && this.options.height) {
2324
+ this.fitHeader();
2325
+ }
2326
+ if (this.options.showFooter) {
2327
+ this.fitFooter();
2328
+ }
2329
+ };
2330
+
2331
+ BootstrapTable.prototype.showColumn = function (field) {
2332
+ this.toggleColumn(getFieldIndex(this.columns, field), true, true);
2333
+ };
2334
+
2335
+ BootstrapTable.prototype.hideColumn = function (field) {
2336
+ this.toggleColumn(getFieldIndex(this.columns, field), false, true);
2337
+ };
2338
+
2339
+ BootstrapTable.prototype.getHiddenColumns = function () {
2340
+ return $.grep(this.columns, function( column ) {
2341
+ return !column.visible;
2342
+ });
2343
+ };
2344
+
2345
+ BootstrapTable.prototype.filterBy = function (columns) {
2346
+ this.filterColumns = $.isEmptyObject(columns) ? {} : columns;
2347
+ this.options.pageNumber = 1;
2348
+ this.initSearch();
2349
+ this.updatePagination();
2350
+ };
2351
+
2352
+ BootstrapTable.prototype.scrollTo = function (value) {
2353
+ if (typeof value === 'string') {
2354
+ value = value === 'bottom' ? this.$tableBody[0].scrollHeight : 0;
2355
+ }
2356
+ if (typeof value === 'number') {
2357
+ this.$tableBody.scrollTop(value);
2358
+ }
2359
+ if (typeof value === 'undefined') {
2360
+ return this.$tableBody.scrollTop();
2361
+ }
2362
+ };
2363
+
2364
+ BootstrapTable.prototype.getScrollPosition = function () {
2365
+ return this.scrollTo();
2366
+ };
2367
+
2368
+ BootstrapTable.prototype.selectPage = function (page) {
2369
+ if (page > 0 && page <= this.options.totalPages) {
2370
+ this.options.pageNumber = page;
2371
+ this.updatePagination();
2372
+ }
2373
+ };
2374
+
2375
+ BootstrapTable.prototype.prevPage = function () {
2376
+ if (this.options.pageNumber > 1) {
2377
+ this.options.pageNumber--;
2378
+ this.updatePagination();
2379
+ }
2380
+ };
2381
+
2382
+ BootstrapTable.prototype.nextPage = function () {
2383
+ if (this.options.pageNumber < this.options.totalPages) {
2384
+ this.options.pageNumber++;
2385
+ this.updatePagination();
2386
+ }
2387
+ };
2388
+
2389
+ BootstrapTable.prototype.toggleView = function () {
2390
+ this.options.cardView = !this.options.cardView;
2391
+ this.initHeader();
2392
+ // Fixed remove toolbar when click cardView button.
2393
+ //that.initToolbar();
2394
+ this.initBody();
2395
+ this.trigger('toggle', this.options.cardView);
2396
+ };
2397
+
2398
+ BootstrapTable.prototype.refreshOptions = function (options) {
2399
+ //If the objects are equivalent then avoid the call of destroy / init methods
2400
+ if (compareObjects(this.options, options, false)) {
2401
+ return;
2402
+ }
2403
+ this.options = $.extend(this.options, options);
2404
+ this.trigger('refresh-options', this.options);
2405
+ this.destroy();
2406
+ this.init();
2407
+ };
2408
+
2409
+ // BOOTSTRAP TABLE PLUGIN DEFINITION
2410
+ // =======================
2411
+
2412
+ var allowedMethods = [
2413
+ 'getOptions',
2414
+ 'getSelections', 'getAllSelections', 'getData',
2415
+ 'load', 'append', 'prepend', 'remove', 'removeAll',
2416
+ 'insertRow', 'updateRow', 'updateCell', 'removeByUniqueId',
2417
+ 'getRowByUniqueId', 'showRow', 'hideRow', 'getRowsHidden',
2418
+ 'mergeCells',
2419
+ 'checkAll', 'uncheckAll',
2420
+ 'check', 'uncheck',
2421
+ 'checkBy', 'uncheckBy',
2422
+ 'refresh',
2423
+ 'resetView',
2424
+ 'resetWidth',
2425
+ 'destroy',
2426
+ 'showLoading', 'hideLoading',
2427
+ 'showColumn', 'hideColumn', 'getHiddenColumns',
2428
+ 'filterBy',
2429
+ 'scrollTo',
2430
+ 'getScrollPosition',
2431
+ 'selectPage', 'prevPage', 'nextPage',
2432
+ 'togglePagination',
2433
+ 'toggleView',
2434
+ 'refreshOptions'
2435
+ ];
2436
+
2437
+ $.fn.bootstrapTable = function (option) {
2438
+ var value,
2439
+ args = Array.prototype.slice.call(arguments, 1);
2440
+
2441
+ this.each(function () {
2442
+ var $this = $(this),
2443
+ data = $this.data('bootstrap.table'),
2444
+ options = $.extend({}, BootstrapTable.DEFAULTS, $this.data(),
2445
+ typeof option === 'object' && option);
2446
+
2447
+ if (typeof option === 'string') {
2448
+ if ($.inArray(option, allowedMethods) < 0) {
2449
+ throw new Error("Unknown method: " + option);
2450
+ }
2451
+
2452
+ if (!data) {
2453
+ return;
2454
+ }
2455
+
2456
+ value = data[option].apply(data, args);
2457
+
2458
+ if (option === 'destroy') {
2459
+ $this.removeData('bootstrap.table');
2460
+ }
2461
+ }
2462
+
2463
+ if (!data) {
2464
+ $this.data('bootstrap.table', (data = new BootstrapTable(this, options)));
2465
+ }
2466
+ });
2467
+
2468
+ return typeof value === 'undefined' ? this : value;
2469
+ };
2470
+
2471
+ $.fn.bootstrapTable.Constructor = BootstrapTable;
2472
+ $.fn.bootstrapTable.defaults = BootstrapTable.DEFAULTS;
2473
+ $.fn.bootstrapTable.columnDefaults = BootstrapTable.COLUMN_DEFAULTS;
2474
+ $.fn.bootstrapTable.locales = BootstrapTable.LOCALES;
2475
+ $.fn.bootstrapTable.methods = allowedMethods;
2476
+
2477
+ // BOOTSTRAP TABLE INIT
2478
+ // =======================
2479
+
2480
+ $(function () {
2481
+ $('[data-toggle="table"]').bootstrapTable();
2482
+ });
2483
+
2484
+ }(jQuery);