index.html 37 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099
  1. <!doctype html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  6. <meta name="description" content="The Events API of Bootstrap Table.">
  7. <meta name="author" content="Zhixin Wen, and Bootstrap Table contributors">
  8. <meta name="generator" content="Jekyll v3.8.7">
  9. <meta name="keywords" content="bootstrap,table,pagination,checkbox,radio,datatables,css,css-framework,semantic,semantic-ui,bulma,material,material-design,materialize,foundation">
  10. <meta name="docsearch:language" content="en">
  11. <title>Events · Bootstrap Table</title>
  12. <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/css/bootstrap.min.css"><!-- Documentation extras -->
  13. <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/docsearch.js@2/dist/cdn/docsearch.min.css">
  14. <link rel="stylesheet" href="/assets/css/docs.min.css">
  15. <link rel="stylesheet" href="/assets/css/style.css?m=9">
  16. <!-- Favicons -->
  17. <link rel="icon" href="/favicon.png">
  18. <script type="text/javascript">
  19. if (window !== top) // 判断当前的 window 对象是否是 top 对象
  20. top.location.href = window.location.href // 如果不是,将 top 对象的网址自动导向被嵌入网页的网址
  21. </script>
  22. </head>
  23. <body>
  24. <a class="skippy sr-only sr-only-focusable" href="#content">
  25. <span class="skippy-text">Skip to main content</span>
  26. </a>
  27. <header class="navbar navbar-expand navbar-dark flex-column flex-md-row bd-navbar">
  28. <a class="navbar-brand mr-0 mr-md-2" href="/" aria-label="Bootstrap">
  29. <img src="/favicon.png" width="36" height="36">
  30. </a>
  31. <div class="navbar-nav-scroll">
  32. <ul class="navbar-nav bd-navbar-nav flex-row">
  33. <li class="nav-item">
  34. <a class="nav-link "
  35. href="/">Home</a>
  36. </li>
  37. <li class="nav-item">
  38. <a class="nav-link active"
  39. href="/docs/getting-started/introduction/">
  40. Documentation
  41. </a>
  42. </li>
  43. <li class="nav-item ">
  44. <a class="nav-link" href="/themes">
  45. Themes
  46. </a>
  47. </li>
  48. <li class="nav-item">
  49. <a class="nav-link "
  50. href="https://examples.bootstrap-table.com">
  51. Examples
  52. </a>
  53. </li>
  54. <li class="nav-item">
  55. <a class="nav-link"
  56. href="https://live.bootstrap-table.com"
  57. target="_blank">
  58. Online Editor
  59. </a>
  60. </li>
  61. <li class="nav-item ">
  62. <a class="nav-link" href="/news">
  63. News
  64. </a>
  65. </li>
  66. <li class="nav-item">
  67. <a class="nav-link"
  68. href="https://blog.bootstrap-table.com"
  69. target="_blank">
  70. Blog
  71. </a>
  72. </li>
  73. </ul>
  74. </div>
  75. <ul class="navbar-nav flex-row ml-md-auto d-none d-md-flex">
  76. <li class="nav-item dropdown">
  77. <a class="nav-item nav-link dropdown-toggle mr-md-2" href="#" id="bd-versions" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
  78. v1.23.5
  79. </a>
  80. <div class="dropdown-menu dropdown-menu-md-right" aria-labelledby="bd-versions">
  81. <a class="dropdown-item active" href="/">Latest (1.23.5)</a>
  82. <a class="dropdown-item" href="http://bootstrap-table.com/versions/1.21.4/" target="_blank">v1.21.4</a>
  83. <a class="dropdown-item" href="http://bootstrap-table.com/versions/1.20.2/" target="_blank">v1.20.2</a>
  84. <a class="dropdown-item" href="http://bootstrap-table.com/versions/1.19.1/" target="_blank">v1.19.1</a>
  85. <a class="dropdown-item" href="http://bootstrap-table.com/versions/1.18.3/" target="_blank">v1.18.3</a>
  86. <a class="dropdown-item" href="http://bootstrap-table.com/versions/1.17.1/" target="_blank">v1.17.1</a>
  87. <a class="dropdown-item" href="http://bootstrap-table.com/versions/1.16.0/" target="_blank">v1.16.0</a>
  88. <a class="dropdown-item" href="http://bootstrap-table.com/versions/1.15.5/" target="_blank">v1.15.5</a>
  89. </div>
  90. </li>
  91. <li class="nav-item">
  92. <a class="nav-link p-2" href="https://github.com/wenzhixin/bootstrap-table" target="_blank" rel="noopener" aria-label="GitHub"><svg class="navbar-nav-svg" xmlns="http://www.w3.org/2000/svg" viewbox="0 0 512 499.36" focusable="false" role="img"><path d="M256 0C114.64 0 0 114.61 0 256c0 113.09 73.34 209 175.08 242.9 12.8 2.35 17.47-5.56 17.47-12.34 0-6.08-.22-22.18-.35-43.54-71.2 15.49-86.2-34.34-86.2-34.34-11.64-29.57-28.42-37.45-28.42-37.45-23.27-15.84 1.73-15.55 1.73-15.55 25.69 1.81 39.21 26.38 39.21 26.38 22.84 39.12 59.92 27.82 74.5 21.27 2.33-16.54 8.94-27.82 16.25-34.22-56.84-6.43-116.6-28.43-116.6-126.49 0-27.95 10-50.8 26.35-68.69-2.63-6.48-11.42-32.5 2.51-67.75 0 0 21.49-6.88 70.4 26.24a242.65 242.65 0 0 1 128.18 0c48.87-33.13 70.33-26.24 70.33-26.24 14 35.25 5.18 61.27 2.55 67.75 16.41 17.9 26.31 40.75 26.31 68.69 0 98.35-59.85 120-116.88 126.32 9.19 7.9 17.38 23.53 17.38 47.41 0 34.22-.31 61.83-.31 70.23 0 6.85 4.61 14.81 17.6 12.31C438.72 464.97 512 369.08 512 256.02 512 114.62 397.37 0 256 0z" fill="currentColor" fill-rule="evenodd"/></svg>
  93. </a>
  94. </li>
  95. <li class="nav-item">
  96. <a class="nav-link p-2" href="https://twitter.com/wenzhixin2010" target="_blank" rel="noopener" aria-label="Twitter"><svg class="navbar-nav-svg" xmlns="http://www.w3.org/2000/svg" viewbox="0 0 512 416.32" focusable="false" role="img"><path d="M160.83 416.32c193.2 0 298.92-160.22 298.92-298.92 0-4.51 0-9-.2-13.52A214 214 0 0 0 512 49.38a212.93 212.93 0 0 1-60.44 16.6 105.7 105.7 0 0 0 46.3-58.19 209 209 0 0 1-66.79 25.37 105.09 105.09 0 0 0-181.73 71.91 116.12 116.12 0 0 0 2.66 24c-87.28-4.3-164.73-46.3-216.56-109.82A105.48 105.48 0 0 0 68 159.6a106.27 106.27 0 0 1-47.53-13.11v1.43a105.28 105.28 0 0 0 84.21 103.06 105.67 105.67 0 0 1-47.33 1.84 105.06 105.06 0 0 0 98.14 72.94A210.72 210.72 0 0 1 25 370.84a202.17 202.17 0 0 1-25-1.43 298.85 298.85 0 0 0 160.83 46.92" fill="currentColor"/></svg>
  97. </a>
  98. </li>
  99. <li class="nav-item">
  100. <a class="nav-link p-2" href="https://opencollective.com/bootstrap-table" target="_blank" rel="noopener" aria-label="Open Collective"><svg class="navbar-nav-svg" xmlns="http://www.w3.org/2000/svg" viewbox="0 0 40 41" focusable="false" role="img" fill="currentColor" fill-rule="evenodd"><title>Open Collective</title><path d="M32.8 21c0 2.4-.8 4.9-2 6.9l5.1 5.1c2.5-3.4 4.1-7.6 4.1-12 0-4.6-1.6-8.8-4-12.2L30.7 14c1.2 2 2 4.3 2 7z" fill-opacity=".4"/><path d="M20 33.7a12.8 12.8 0 0 1 0-25.6c2.6 0 5 .7 7 2.1L32 5a20 20 0 1 0 .1 31.9l-5-5.2a13 13 0 0 1-7 2z"/></svg>
  101. </a>
  102. </li>
  103. </ul>
  104. <a class="btn btn-bd-download d-none d-lg-inline-block mb-3 mb-md-0 ml-md-3"
  105. href="/docs/getting-started/download/">Download</a>
  106. </header>
  107. <div class="container-fluid">
  108. <div class="row flex-xl-nowrap">
  109. <div class="col-12 col-md-3 col-xl-2 bd-sidebar">
  110. <form class="bd-search d-flex align-items-center">
  111. <input type="search" class="form-control"
  112. id="search-input" placeholder="Search..."
  113. aria-label="Search for..." autocomplete="off">
  114. <button class="btn btn-link bd-search-docs-toggle d-md-none p-0 ml-3"
  115. type="button" data-toggle="collapse" data-target="#bd-docs-nav"
  116. aria-controls="bd-docs-nav" aria-expanded="false"
  117. aria-label="Toggle docs navigation"><svg xmlns="http://www.w3.org/2000/svg" viewbox="0 0 30 30" width="30" height="30" focusable="false" role="img"><title>Menu</title><path stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-miterlimit="10" d="M4 7h22M4 15h22M4 23h22"/></svg>
  118. </button>
  119. </form>
  120. <nav class="collapse bd-links" id="bd-docs-nav"><div class="bd-toc-item">
  121. <a class="bd-toc-link" href="/docs/getting-started/introduction/">
  122. Getting started
  123. </a>
  124. <ul class="nav bd-sidenav"><li>
  125. <a href="/docs/getting-started/introduction/">
  126. Introduction
  127. </a>
  128. </li><li>
  129. <a href="/docs/getting-started/download/">
  130. Download
  131. </a>
  132. </li><li>
  133. <a href="/docs/getting-started/contents/">
  134. Contents
  135. </a>
  136. </li><li>
  137. <a href="/docs/getting-started/usage/">
  138. Usage
  139. </a>
  140. </li><li>
  141. <a href="/docs/getting-started/browsers-devices/">
  142. Browsers & devices
  143. </a>
  144. </li><li>
  145. <a href="/docs/getting-started/build-tools/">
  146. Build tools
  147. </a>
  148. </li></ul>
  149. </div><div class="bd-toc-item active">
  150. <a class="bd-toc-link" href="/docs/api/table-options/">
  151. API
  152. </a>
  153. <ul class="nav bd-sidenav"><li>
  154. <a href="/docs/api/table-options/">
  155. Table Options
  156. </a>
  157. </li><li>
  158. <a href="/docs/api/column-options/">
  159. Column Options
  160. </a>
  161. </li><li class="active bd-sidenav-active">
  162. <a href="/docs/api/events/">
  163. Events
  164. </a>
  165. </li><li>
  166. <a href="/docs/api/methods/">
  167. Methods
  168. </a>
  169. </li><li>
  170. <a href="/docs/api/localizations/">
  171. Localizations
  172. </a>
  173. </li></ul>
  174. </div><div class="bd-toc-item">
  175. <a class="bd-toc-link" href="/docs/extensions/addrbar/">
  176. Extensions
  177. </a>
  178. <ul class="nav bd-sidenav"><li>
  179. <a href="/docs/extensions/addrbar/">
  180. Addrbar
  181. </a>
  182. </li><li>
  183. <a href="/docs/extensions/auto-refresh/">
  184. Auto Refresh
  185. </a>
  186. </li><li>
  187. <a href="/docs/extensions/cookie/">
  188. Cookie
  189. </a>
  190. </li><li>
  191. <a href="/docs/extensions/copy-rows/">
  192. Copy Rows
  193. </a>
  194. </li><li>
  195. <a href="/docs/extensions/custom-view/">
  196. Custom View
  197. </a>
  198. </li><li>
  199. <a href="/docs/extensions/defer-url/">
  200. Defer URL
  201. </a>
  202. </li><li>
  203. <a href="/docs/extensions/editable/">
  204. Editable
  205. </a>
  206. </li><li>
  207. <a href="/docs/extensions/export/">
  208. Export
  209. </a>
  210. </li><li>
  211. <a href="/docs/extensions/filter-control/">
  212. Filter Control
  213. </a>
  214. </li><li>
  215. <a href="/docs/extensions/fixed-columns/">
  216. Fixed Columns
  217. </a>
  218. </li><li>
  219. <a href="/docs/extensions/group-by-v2/">
  220. Group By v2
  221. </a>
  222. </li><li>
  223. <a href="/docs/extensions/i18n-enhance/">
  224. i18n Enhance
  225. </a>
  226. </li><li>
  227. <a href="/docs/extensions/key-events/">
  228. Key Events
  229. </a>
  230. </li><li>
  231. <a href="/docs/extensions/mobile/">
  232. Mobile
  233. </a>
  234. </li><li>
  235. <a href="/docs/extensions/multiple-sort/">
  236. Multiple Sort
  237. </a>
  238. </li><li>
  239. <a href="/docs/extensions/page-jump-to/">
  240. Page Jump To
  241. </a>
  242. </li><li>
  243. <a href="/docs/extensions/pipeline/">
  244. Pipeline
  245. </a>
  246. </li><li>
  247. <a href="/docs/extensions/print/">
  248. Print
  249. </a>
  250. </li><li>
  251. <a href="/docs/extensions/reorder-columns/">
  252. Reorder Columns
  253. </a>
  254. </li><li>
  255. <a href="/docs/extensions/reorder-rows/">
  256. Reorder Rows
  257. </a>
  258. </li><li>
  259. <a href="/docs/extensions/resizable/">
  260. Resizable
  261. </a>
  262. </li><li>
  263. <a href="/docs/extensions/sticky-header/">
  264. Sticky Header
  265. </a>
  266. </li><li>
  267. <a href="/docs/extensions/toolbar/">
  268. Toolbar
  269. </a>
  270. </li><li>
  271. <a href="/docs/extensions/treegrid/">
  272. Treegrid
  273. </a>
  274. </li></ul>
  275. </div><div class="bd-toc-item">
  276. <a class="bd-toc-link" href="/docs/vuejs/introduction/">
  277. VueJS
  278. </a>
  279. <ul class="nav bd-sidenav"><li>
  280. <a href="/docs/vuejs/introduction/">
  281. Introduction
  282. </a>
  283. </li><li>
  284. <a href="/docs/vuejs/browser/">
  285. Browser
  286. </a>
  287. </li><li>
  288. <a href="/docs/vuejs/webpack/">
  289. Webpack
  290. </a>
  291. </li><li>
  292. <a href="/docs/vuejs/component/">
  293. Component
  294. </a>
  295. </li></ul>
  296. </div><div class="bd-toc-item">
  297. <a class="bd-toc-link" href="/docs/online-editor/">
  298. Online Editor
  299. </a>
  300. <ul class="nav bd-sidenav"></ul>
  301. </div><div class="bd-toc-item">
  302. <a class="bd-toc-link" href="/docs/faq/">
  303. FAQ
  304. </a>
  305. <ul class="nav bd-sidenav"></ul>
  306. </div><div class="bd-toc-item">
  307. <a class="bd-toc-link" href="/docs/about/overview/">
  308. About
  309. </a>
  310. <ul class="nav bd-sidenav"><li>
  311. <a href="/docs/about/overview/">
  312. Overview
  313. </a>
  314. </li><li>
  315. <a href="/docs/about/team/">
  316. Team
  317. </a>
  318. </li><li>
  319. <a href="/docs/about/license/">
  320. License
  321. </a>
  322. </li><li>
  323. <a href="/docs/about/translations/">
  324. Translations
  325. </a>
  326. </li></ul>
  327. </div></nav>
  328. </div>
  329. <div class="d-none d-xl-block col-xl-2 bd-toc">
  330. <ul class="section-nav">
  331. <li class="toc-entry toc-h2"><a href="#onall">onAll</a></li>
  332. <li class="toc-entry toc-h2"><a href="#oncheck">onCheck</a></li>
  333. <li class="toc-entry toc-h2"><a href="#oncheckall">onCheckAll</a></li>
  334. <li class="toc-entry toc-h2"><a href="#onchecksome">onCheckSome</a></li>
  335. <li class="toc-entry toc-h2"><a href="#onclickcell">onClickCell</a></li>
  336. <li class="toc-entry toc-h2"><a href="#onclickrow">onClickRow</a></li>
  337. <li class="toc-entry toc-h2"><a href="#oncollapserow">onCollapseRow</a></li>
  338. <li class="toc-entry toc-h2"><a href="#oncolumnswitch">onColumnSwitch</a></li>
  339. <li class="toc-entry toc-h2"><a href="#oncolumnswitchall">onColumnSwitchAll</a></li>
  340. <li class="toc-entry toc-h2"><a href="#ondblclickcell">onDblClickCell</a></li>
  341. <li class="toc-entry toc-h2"><a href="#ondblclickrow">onDblClickRow</a></li>
  342. <li class="toc-entry toc-h2"><a href="#onexpandrow">onExpandRow</a></li>
  343. <li class="toc-entry toc-h2"><a href="#onloaderror">onLoadError</a></li>
  344. <li class="toc-entry toc-h2"><a href="#onloadsuccess">onLoadSuccess</a></li>
  345. <li class="toc-entry toc-h2"><a href="#onpagechange">onPageChange</a></li>
  346. <li class="toc-entry toc-h2"><a href="#onpostbody">onPostBody</a></li>
  347. <li class="toc-entry toc-h2"><a href="#onpostfooter">onPostFooter</a></li>
  348. <li class="toc-entry toc-h2"><a href="#onpostheader">onPostHeader</a></li>
  349. <li class="toc-entry toc-h2"><a href="#onprebody">onPreBody</a></li>
  350. <li class="toc-entry toc-h2"><a href="#onrefresh">onRefresh</a></li>
  351. <li class="toc-entry toc-h2"><a href="#onrefreshoptions">onRefreshOptions</a></li>
  352. <li class="toc-entry toc-h2"><a href="#onresetview">onResetView</a></li>
  353. <li class="toc-entry toc-h2"><a href="#onscrollbody">onScrollBody</a></li>
  354. <li class="toc-entry toc-h2"><a href="#onsearch">onSearch</a></li>
  355. <li class="toc-entry toc-h2"><a href="#onsort">onSort</a></li>
  356. <li class="toc-entry toc-h2"><a href="#ontoggle">onToggle</a></li>
  357. <li class="toc-entry toc-h2"><a href="#ontogglepagination">onTogglePagination</a></li>
  358. <li class="toc-entry toc-h2"><a href="#onuncheck">onUncheck</a></li>
  359. <li class="toc-entry toc-h2"><a href="#onuncheckall">onUncheckAll</a></li>
  360. <li class="toc-entry toc-h2"><a href="#onunchecksome">onUncheckSome</a></li>
  361. <li class="toc-entry toc-h2"><a href="#onvirtualscroll">onVirtualScroll</a></li>
  362. </ul>
  363. </div>
  364. <main class="col-12 col-md-9 col-xl-8 py-md-3 pl-md-5 bd-content api" role="main">
  365. <div class="d-md-flex flex-md-row-reverse align-items-center justify-content-between">
  366. <a class="btn btn-sm btn-bd-light mb-2 mb-md-0"
  367. href="https://github.com/wenzhixin/bootstrap-table/blob/develop/site/docs/api/events.md"
  368. title="View and edit this file on GitHub" target="_blank" rel="noopener">
  369. View on GitHub
  370. </a>
  371. <h1 class="bd-title" id="content">
  372. Events
  373. </h1>
  374. </div>
  375. <p class="bd-lead">The Events API of Bootstrap Table.</p>
  376. <div id="gg"></div>
  377. <p>Events can be bound in two ways:</p>
  378. <ul>
  379. <li>via the option object</li>
  380. <li>via jquery event handler</li>
  381. </ul>
  382. <p>Binding via the options object:</p>
  383. <figure class="highlight"><pre><code class="language-html" data-lang="html">// Here, you can expect to have as the last parameter the bootstrap-table object
  384. $('#table').bootstrapTable({
  385. onEventName: function (arg1, arg2, ...) {
  386. // ...
  387. }
  388. })</code></pre></figure>
  389. <p>Binding via the jquery event handler:</p>
  390. <figure class="highlight"><pre><code class="language-html" data-lang="html">// Here, you can expect to have in the 'e' variable the sender property, which is the bootstrap-table object
  391. $('#table').on('event-name.bs.table', function (e, arg1, arg2, ...) {
  392. // ...
  393. })</code></pre></figure>
  394. <p><em>Hint: if you use the jquery event handler, make sure to bind the event listener before the event is executed!</em></p>
  395. <h2 id="onall">onAll</h2>
  396. <ul>
  397. <li>
  398. <p><strong>jQuery Event:</strong> <code class="highlighter-rouge">all.bs.table</code></p>
  399. </li>
  400. <li>
  401. <p><strong>Parameter:</strong> <code class="highlighter-rouge">name, args</code></p>
  402. </li>
  403. <li>
  404. <p><strong>Detail:</strong></p>
  405. <p>It fires when any event triggers. The parameters contain:</p>
  406. <ul>
  407. <li><code class="highlighter-rouge">name</code>: the event name,</li>
  408. <li><code class="highlighter-rouge">args</code>: the event data.</li>
  409. </ul>
  410. </li>
  411. </ul>
  412. <h2 id="oncheck">onCheck</h2>
  413. <ul>
  414. <li>
  415. <p><strong>jQuery Event:</strong> <code class="highlighter-rouge">check.bs.table</code></p>
  416. </li>
  417. <li>
  418. <p><strong>Parameter:</strong> <code class="highlighter-rouge">row, $element</code></p>
  419. </li>
  420. <li>
  421. <p><strong>Detail:</strong></p>
  422. <p>It fires when the user checks a row. The parameters contain:</p>
  423. <ul>
  424. <li><code class="highlighter-rouge">row</code>: the record corresponding to the clicked row.</li>
  425. <li><code class="highlighter-rouge">$element</code>: the DOM element checked.</li>
  426. </ul>
  427. </li>
  428. </ul>
  429. <h2 id="oncheckall">onCheckAll</h2>
  430. <ul>
  431. <li>
  432. <p><strong>jQuery Event:</strong> <code class="highlighter-rouge">check-all.bs.table</code></p>
  433. </li>
  434. <li>
  435. <p><strong>Parameter:</strong> <code class="highlighter-rouge">rowsAfter, rowsBefore</code></p>
  436. </li>
  437. <li>
  438. <p><strong>Detail:</strong></p>
  439. <p>It fires when the user checks all rows. The parameters contain:</p>
  440. <ul>
  441. <li><code class="highlighter-rouge">rowsAfter</code>: array of records of the now checked rows.</li>
  442. <li><code class="highlighter-rouge">rowsBefore</code>: array of records of the checked rows before.</li>
  443. </ul>
  444. </li>
  445. </ul>
  446. <h2 id="onchecksome">onCheckSome</h2>
  447. <ul>
  448. <li>
  449. <p><strong>jQuery Event:</strong> <code class="highlighter-rouge">check-some.bs.table</code></p>
  450. </li>
  451. <li>
  452. <p><strong>Parameter:</strong> <code class="highlighter-rouge">rows</code></p>
  453. </li>
  454. <li>
  455. <p><strong>Detail:</strong></p>
  456. <p>It fires when the user checks some rows. The parameters contain:</p>
  457. <ul>
  458. <li><code class="highlighter-rouge">rows</code>: array of records corresponding to newly checked rows.</li>
  459. </ul>
  460. </li>
  461. </ul>
  462. <h2 id="onclickcell">onClickCell</h2>
  463. <ul>
  464. <li>
  465. <p><strong>jQuery Event:</strong> <code class="highlighter-rouge">click-cell.bs.table</code></p>
  466. </li>
  467. <li>
  468. <p><strong>Parameter:</strong> <code class="highlighter-rouge">field, value, row, $element</code></p>
  469. </li>
  470. <li>
  471. <p><strong>Detail:</strong></p>
  472. <p>It fires when the user clicks a cell. The parameters contain:</p>
  473. <ul>
  474. <li><code class="highlighter-rouge">field</code>: the field name corresponding to the clicked cell.</li>
  475. <li><code class="highlighter-rouge">value</code>: the data value corresponding to the clicked cell.</li>
  476. <li><code class="highlighter-rouge">row</code>: the record corresponding to the clicked row.</li>
  477. <li><code class="highlighter-rouge">$element</code>: the td element.</li>
  478. </ul>
  479. </li>
  480. </ul>
  481. <h2 id="onclickrow">onClickRow</h2>
  482. <ul>
  483. <li>
  484. <p><strong>jQuery Event:</strong> <code class="highlighter-rouge">click-row.bs.table</code></p>
  485. </li>
  486. <li>
  487. <p><strong>Parameter:</strong> <code class="highlighter-rouge">row, $element, field</code></p>
  488. </li>
  489. <li>
  490. <p><strong>Detail:</strong></p>
  491. <p>It fires when the user clicks a row. The parameters contain:</p>
  492. <ul>
  493. <li><code class="highlighter-rouge">row</code>: the record corresponding to the clicked row.</li>
  494. <li><code class="highlighter-rouge">$element</code>: the tr element.</li>
  495. <li><code class="highlighter-rouge">field</code>: the field name corresponding to the clicked cell.</li>
  496. </ul>
  497. </li>
  498. </ul>
  499. <h2 id="oncollapserow">onCollapseRow</h2>
  500. <ul>
  501. <li>
  502. <p><strong>jQuery Event:</strong> <code class="highlighter-rouge">collapse-row.bs.table</code></p>
  503. </li>
  504. <li>
  505. <p><strong>Parameter:</strong> <code class="highlighter-rouge">index, row, detailView</code></p>
  506. </li>
  507. <li>
  508. <p><strong>Detail:</strong></p>
  509. <p>It fires when you click the detail icon to collapse the detail view. The parameters contain:</p>
  510. <ul>
  511. <li><code class="highlighter-rouge">index</code>: the index of the collapsed row.</li>
  512. <li><code class="highlighter-rouge">row</code>: the record corresponding to the collapsed row.</li>
  513. <li><code class="highlighter-rouge">detailView</code>: the collapsed detailView.</li>
  514. </ul>
  515. </li>
  516. </ul>
  517. <h2 id="oncolumnswitch">onColumnSwitch</h2>
  518. <ul>
  519. <li>
  520. <p><strong>jQuery Event:</strong> <code class="highlighter-rouge">column-switch.bs.table</code></p>
  521. </li>
  522. <li>
  523. <p><strong>Parameter:</strong> <code class="highlighter-rouge">field, checked</code></p>
  524. </li>
  525. <li>
  526. <p><strong>Detail:</strong></p>
  527. <p>It fires when switch the column visible (<a href="/docs/api/table-options/#showcolumns">showColumns</a>). The parameters contain:</p>
  528. <ul>
  529. <li><code class="highlighter-rouge">field</code>: the field name corresponding to the switch column.</li>
  530. <li><code class="highlighter-rouge">checked</code>: the checked state of the column.</li>
  531. </ul>
  532. </li>
  533. </ul>
  534. <h2 id="oncolumnswitchall">onColumnSwitchAll</h2>
  535. <ul>
  536. <li>
  537. <p><strong>jQuery Event:</strong> <code class="highlighter-rouge">column-switch-all.bs.table</code></p>
  538. </li>
  539. <li>
  540. <p><strong>Parameter:</strong> <code class="highlighter-rouge">checked</code></p>
  541. </li>
  542. <li>
  543. <p><strong>Detail:</strong></p>
  544. <p>It fires when toggle all columns. The parameters contain:</p>
  545. <ul>
  546. <li><code class="highlighter-rouge">checked</code>: the checked state of the column.</li>
  547. </ul>
  548. </li>
  549. </ul>
  550. <h2 id="ondblclickcell">onDblClickCell</h2>
  551. <ul>
  552. <li>
  553. <p><strong>jQuery Event:</strong> <code class="highlighter-rouge">dbl-click-cell.bs.table</code></p>
  554. </li>
  555. <li>
  556. <p><strong>Parameter:</strong> <code class="highlighter-rouge">field, value, row, $element</code></p>
  557. </li>
  558. <li>
  559. <p><strong>Detail:</strong></p>
  560. <p>It fires when the user double click a cell. The parameters contain:</p>
  561. <ul>
  562. <li><code class="highlighter-rouge">field</code>: the field name corresponding to the clicked cell.</li>
  563. <li><code class="highlighter-rouge">value</code>: the data value corresponding to the clicked cell.</li>
  564. <li><code class="highlighter-rouge">row</code>: the record corresponding to the clicked row.</li>
  565. <li><code class="highlighter-rouge">$element</code>: the td element.</li>
  566. </ul>
  567. </li>
  568. </ul>
  569. <h2 id="ondblclickrow">onDblClickRow</h2>
  570. <ul>
  571. <li>
  572. <p><strong>jQuery Event:</strong> <code class="highlighter-rouge">dbl-click-row.bs.table</code></p>
  573. </li>
  574. <li>
  575. <p><strong>Parameter:</strong> <code class="highlighter-rouge">row, $element, field</code></p>
  576. </li>
  577. <li>
  578. <p><strong>Detail:</strong></p>
  579. <p>It fires when the user doubles click a row. The parameters contain:</p>
  580. <ul>
  581. <li><code class="highlighter-rouge">row</code>: the record corresponding to the clicked row.</li>
  582. <li><code class="highlighter-rouge">$element</code>: the tr element.</li>
  583. <li><code class="highlighter-rouge">field</code>: the field name corresponding to the clicked cell.</li>
  584. </ul>
  585. </li>
  586. </ul>
  587. <h2 id="onexpandrow">onExpandRow</h2>
  588. <ul>
  589. <li>
  590. <p><strong>jQuery Event:</strong> <code class="highlighter-rouge">expand-row.bs.table</code></p>
  591. </li>
  592. <li>
  593. <p><strong>Parameter:</strong> <code class="highlighter-rouge">index, row, $detail</code></p>
  594. </li>
  595. <li>
  596. <p><strong>Detail:</strong></p>
  597. <p>It fires when you click the detail icon to expand the detail view. The parameters contain:</p>
  598. <ul>
  599. <li><code class="highlighter-rouge">index</code>: the index of the expanded row.</li>
  600. <li><code class="highlighter-rouge">row</code>: the record corresponding to the expanded row.</li>
  601. <li><code class="highlighter-rouge">$detail</code>: the DOM element of the detail <code class="highlighter-rouge">div</code> after the current <code class="highlighter-rouge">tr</code> element, you can use jQuery methods to custom the detail views.</li>
  602. </ul>
  603. </li>
  604. </ul>
  605. <h2 id="onloaderror">onLoadError</h2>
  606. <ul>
  607. <li>
  608. <p><strong>jQuery Event:</strong> <code class="highlighter-rouge">load-error.bs.table</code></p>
  609. </li>
  610. <li>
  611. <p><strong>Parameter:</strong> <code class="highlighter-rouge">status, jqXHR</code></p>
  612. </li>
  613. <li>
  614. <p><strong>Detail:</strong></p>
  615. <p>It fires when some errors occur to load remote data. The parameters contain:</p>
  616. <ul>
  617. <li><code class="highlighter-rouge">status</code>: the status code of <code class="highlighter-rouge">jqXHR</code>.</li>
  618. <li><code class="highlighter-rouge">jqXHR</code>: jqXHR object, which is a super set of the XMLHTTPRequest object. For more information, see the <a href="http://api.jquery.com/Types/#jqXHR">jqXHR Type</a>.</li>
  619. </ul>
  620. </li>
  621. </ul>
  622. <h2 id="onloadsuccess">onLoadSuccess</h2>
  623. <ul>
  624. <li>
  625. <p><strong>jQuery Event:</strong> <code class="highlighter-rouge">load-success.bs.table</code></p>
  626. </li>
  627. <li>
  628. <p><strong>Parameter:</strong> <code class="highlighter-rouge">data</code></p>
  629. </li>
  630. <li>
  631. <p><strong>Detail:</strong></p>
  632. <p>It fires when remote data is loaded successfully. The parameters contain:</p>
  633. <ul>
  634. <li><code class="highlighter-rouge">data</code>: the remote data loaded into the table. (Note: this data cannot be modified once it’s loaded into the table. If you need to process received data before using it in the table, write your custom <a href="/docs/api/table-options/#responsehandler">responseHandler</a> instead.)</li>
  635. <li><code class="highlighter-rouge">status</code>: the status code of <code class="highlighter-rouge">jqXHR</code>.</li>
  636. <li><code class="highlighter-rouge">jqXHR</code>: jqXHR object, which is a super set of the XMLHTTPRequest object. For more information, see the <a href="http://api.jquery.com/Types/#jqXHR">jqXHR Type</a>.</li>
  637. </ul>
  638. </li>
  639. </ul>
  640. <h2 id="onpagechange">onPageChange</h2>
  641. <ul>
  642. <li>
  643. <p><strong>jQuery Event:</strong> <code class="highlighter-rouge">page-change.bs.table</code></p>
  644. </li>
  645. <li>
  646. <p><strong>Parameter:</strong> <code class="highlighter-rouge">number, size</code></p>
  647. </li>
  648. <li>
  649. <p><strong>Detail:</strong></p>
  650. <p>It fires when changing the page number or page size. The parameters contain:</p>
  651. <ul>
  652. <li><code class="highlighter-rouge">number</code>: the page number.</li>
  653. <li><code class="highlighter-rouge">size</code>: the page size.</li>
  654. </ul>
  655. </li>
  656. </ul>
  657. <h2 id="onpostbody">onPostBody</h2>
  658. <ul>
  659. <li>
  660. <p><strong>jQuery Event:</strong> <code class="highlighter-rouge">post-body.bs.table</code></p>
  661. </li>
  662. <li>
  663. <p><strong>Parameter:</strong> <code class="highlighter-rouge">data</code></p>
  664. </li>
  665. <li>
  666. <p><strong>Detail:</strong></p>
  667. <p>It fires after the table body are rendered and available in the DOM. The parameters contain:</p>
  668. <ul>
  669. <li><code class="highlighter-rouge">data</code>: the rendered data.</li>
  670. </ul>
  671. </li>
  672. </ul>
  673. <h2 id="onpostfooter">onPostFooter</h2>
  674. <ul>
  675. <li>
  676. <p><strong>jQuery Event:</strong> <code class="highlighter-rouge">post-footer.bs.table</code></p>
  677. </li>
  678. <li>
  679. <p><strong>Parameter:</strong> <code class="highlighter-rouge">$tableFooter</code></p>
  680. </li>
  681. <li>
  682. <p><strong>Detail:</strong></p>
  683. <p>It fires after the footer are rendered and available in the DOM. The parameters contain:</p>
  684. <ul>
  685. <li><code class="highlighter-rouge">$tableFooter</code>: the DOM element of the footer.</li>
  686. </ul>
  687. </li>
  688. </ul>
  689. <h2 id="onpostheader">onPostHeader</h2>
  690. <ul>
  691. <li>
  692. <p><strong>jQuery Event:</strong> <code class="highlighter-rouge">post-header.bs.table</code></p>
  693. </li>
  694. <li>
  695. <p><strong>Parameter:</strong> <code class="highlighter-rouge">undefined</code></p>
  696. </li>
  697. <li>
  698. <p><strong>Detail:</strong></p>
  699. <p>It fires after the table header is rendered and available in the DOM.</p>
  700. </li>
  701. </ul>
  702. <h2 id="onprebody">onPreBody</h2>
  703. <ul>
  704. <li>
  705. <p><strong>jQuery Event:</strong> <code class="highlighter-rouge">pre-body.bs.table</code></p>
  706. </li>
  707. <li>
  708. <p><strong>Parameter:</strong> <code class="highlighter-rouge">data</code></p>
  709. </li>
  710. <li>
  711. <p><strong>Detail:</strong></p>
  712. <p>It fires before the table body are rendered. The parameters contain:</p>
  713. <ul>
  714. <li><code class="highlighter-rouge">data</code>: the rendered data.</li>
  715. </ul>
  716. </li>
  717. </ul>
  718. <h2 id="onrefresh">onRefresh</h2>
  719. <ul>
  720. <li>
  721. <p><strong>jQuery Event:</strong> <code class="highlighter-rouge">refresh.bs.table</code></p>
  722. </li>
  723. <li>
  724. <p><strong>Parameter:</strong> <code class="highlighter-rouge">params</code></p>
  725. </li>
  726. <li>
  727. <p><strong>Detail:</strong></p>
  728. <p>It fires after the click of the refresh button. The parameters contain:</p>
  729. <ul>
  730. <li><code class="highlighter-rouge">params</code>: the additional parameters request to the server.</li>
  731. </ul>
  732. </li>
  733. </ul>
  734. <h2 id="onrefreshoptions">onRefreshOptions</h2>
  735. <ul>
  736. <li>
  737. <p><strong>jQuery Event:</strong> <code class="highlighter-rouge">refresh-options.bs.table</code></p>
  738. </li>
  739. <li>
  740. <p><strong>Parameter:</strong> <code class="highlighter-rouge">options</code></p>
  741. </li>
  742. <li>
  743. <p><strong>Detail:</strong></p>
  744. <p>It fires after refreshing the options, and before destroying and init the table. The parameters contain:</p>
  745. <ul>
  746. <li><code class="highlighter-rouge">options</code>: the table options object.</li>
  747. </ul>
  748. </li>
  749. </ul>
  750. <h2 id="onresetview">onResetView</h2>
  751. <ul>
  752. <li>
  753. <p><strong>jQuery Event:</strong> <code class="highlighter-rouge">reset-view.bs.table</code></p>
  754. </li>
  755. <li>
  756. <p><strong>Parameter:</strong> <code class="highlighter-rouge">undefined</code></p>
  757. </li>
  758. <li>
  759. <p><strong>Detail:</strong></p>
  760. <p>It fires when resetting the view of the table.</p>
  761. </li>
  762. </ul>
  763. <h2 id="onscrollbody">onScrollBody</h2>
  764. <ul>
  765. <li>
  766. <p><strong>jQuery Event:</strong> <code class="highlighter-rouge">scroll-body.bs.table</code></p>
  767. </li>
  768. <li>
  769. <p><strong>Parameter:</strong> <code class="highlighter-rouge">$tableBody</code></p>
  770. </li>
  771. <li>
  772. <p><strong>Detail:</strong></p>
  773. <p>It fires when the table body scroll.</p>
  774. <h2 id="onsearch">onSearch</h2>
  775. </li>
  776. <li>
  777. <p><strong>jQuery Event:</strong> <code class="highlighter-rouge">search.bs.table</code></p>
  778. </li>
  779. <li>
  780. <p><strong>Parameter:</strong> <code class="highlighter-rouge">text</code></p>
  781. </li>
  782. <li>
  783. <p><strong>Detail:</strong></p>
  784. <p>It fires when searching the table. The parameters contain:</p>
  785. <ul>
  786. <li><code class="highlighter-rouge">text</code>: the text of the search input.</li>
  787. </ul>
  788. </li>
  789. </ul>
  790. <h2 id="onsort">onSort</h2>
  791. <ul>
  792. <li>
  793. <p><strong>jQuery Event:</strong> <code class="highlighter-rouge">sort.bs.table</code></p>
  794. </li>
  795. <li>
  796. <p><strong>Parameter:</strong> <code class="highlighter-rouge">name, order</code></p>
  797. </li>
  798. <li>
  799. <p><strong>Detail:</strong></p>
  800. <p>It fires when the user sort a column. The parameters contain:</p>
  801. <ul>
  802. <li><code class="highlighter-rouge">name</code>: the sort column field name.</li>
  803. <li><code class="highlighter-rouge">order</code>: the sort column order.</li>
  804. </ul>
  805. </li>
  806. </ul>
  807. <h2 id="ontoggle">onToggle</h2>
  808. <ul>
  809. <li>
  810. <p><strong>jQuery Event:</strong> <code class="highlighter-rouge">toggle.bs.table</code></p>
  811. </li>
  812. <li>
  813. <p><strong>Parameter:</strong> <code class="highlighter-rouge">cardView</code></p>
  814. </li>
  815. <li>
  816. <p><strong>Detail:</strong></p>
  817. <p>It fires when toggling the view of the table. The parameters contain:</p>
  818. <ul>
  819. <li><code class="highlighter-rouge">cardView</code>: the cardView state of the table.</li>
  820. </ul>
  821. </li>
  822. </ul>
  823. <h2 id="ontogglepagination">onTogglePagination</h2>
  824. <ul>
  825. <li>
  826. <p><strong>jQuery Event:</strong> <code class="highlighter-rouge">toggle-pagination.bs.table</code></p>
  827. </li>
  828. <li>
  829. <p><strong>Parameter:</strong> <code class="highlighter-rouge">state</code></p>
  830. </li>
  831. <li>
  832. <p><strong>Detail:</strong></p>
  833. <p>It fires when the pagination is toggled:</p>
  834. <ul>
  835. <li><code class="highlighter-rouge">state</code>: the new pagination state (<code class="highlighter-rouge">true</code>-&gt; Pagination is enabled, <code class="highlighter-rouge">false</code> -&gt; Pagination is disabled )</li>
  836. </ul>
  837. </li>
  838. </ul>
  839. <h2 id="onuncheck">onUncheck</h2>
  840. <ul>
  841. <li>
  842. <p><strong>jQuery Event:</strong> <code class="highlighter-rouge">uncheck.bs.table</code></p>
  843. </li>
  844. <li>
  845. <p><strong>Parameter:</strong> <code class="highlighter-rouge">row, $element</code></p>
  846. </li>
  847. <li>
  848. <p><strong>Detail:</strong></p>
  849. <p>It fires when the user unchecks a row. The parameters contain:</p>
  850. <ul>
  851. <li><code class="highlighter-rouge">row</code>: the record corresponding to the clicked row.</li>
  852. <li><code class="highlighter-rouge">$element</code>: the DOM element unchecked.</li>
  853. </ul>
  854. </li>
  855. </ul>
  856. <h2 id="onuncheckall">onUncheckAll</h2>
  857. <ul>
  858. <li>
  859. <p><strong>jQuery Event:</strong> <code class="highlighter-rouge">uncheck-all.bs.table</code></p>
  860. </li>
  861. <li>
  862. <p><strong>Parameter:</strong> <code class="highlighter-rouge">rowsAfter, rowsBefore</code></p>
  863. </li>
  864. <li>
  865. <p><strong>Detail:</strong></p>
  866. <p>It fires when the user unchecks all rows. The parameters contain:</p>
  867. <ul>
  868. <li><code class="highlighter-rouge">rowsAfter</code>: array of records of the now checked rows.</li>
  869. <li><code class="highlighter-rouge">rowsBefore</code>: array of records of the checked rows before.</li>
  870. </ul>
  871. </li>
  872. </ul>
  873. <h2 id="onunchecksome">onUncheckSome</h2>
  874. <ul>
  875. <li>
  876. <p><strong>jQuery Event:</strong> <code class="highlighter-rouge">uncheck-some.bs.table</code></p>
  877. </li>
  878. <li>
  879. <p><strong>Parameter:</strong> <code class="highlighter-rouge">rows</code></p>
  880. </li>
  881. <li>
  882. <p><strong>Detail:</strong></p>
  883. <p>It fires when the user unchecks some rows. The parameters contain:</p>
  884. <ul>
  885. <li><code class="highlighter-rouge">rows</code>: array of records corresponding to previously checked rows.</li>
  886. </ul>
  887. </li>
  888. </ul>
  889. <h2 id="onvirtualscroll">onVirtualScroll</h2>
  890. <ul>
  891. <li>
  892. <p><strong>jQuery Event:</strong> <code class="highlighter-rouge">virtual-scroll.bs.table</code></p>
  893. </li>
  894. <li>
  895. <p><strong>Parameter:</strong> <code class="highlighter-rouge">startIndex, endIndex</code></p>
  896. </li>
  897. <li>
  898. <p><strong>Detail:</strong></p>
  899. <p>It fires when the user scrolls the virtual scroll. The parameters contain:</p>
  900. <ul>
  901. <li><code class="highlighter-rouge">startIndex</code>: the start row index of the virtual scroll.</li>
  902. <li><code class="highlighter-rouge">endIndex</code>: the end row index of the virtual scroll.</li>
  903. </ul>
  904. </li>
  905. </ul>
  906. </main>
  907. </div>
  908. </div>
  909. <script src="https://cdn.jsdelivr.net/npm/jquery/dist/jquery.min.js"></script>
  910. <script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.1/dist/umd/popper.min.js"></script>
  911. <script src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/js/bootstrap.min.js"></script>
  912. <script async defer src="https://buttons.github.io/buttons.js"></script><script src="https://cdn.jsdelivr.net/npm/docsearch.js@2/dist/cdn/docsearch.min.js"></script>
  913. <script>
  914. $(function () {
  915. $('.bd-content.api a').attr('target', '_blank')
  916. })
  917. </script><script src="https://gg.wenzhixin.net.cn/bootstrap-table/gg.js"></script>
  918. <script src="/assets/js/docs.min.js?m=1"></script>
  919. <!-- Global site tag (gtag.js) - Google Analytics -->
  920. <script async src="https://www.googletagmanager.com/gtag/js?id=UA-132747866-1"></script>
  921. <script>
  922. window.dataLayer = window.dataLayer || []
  923. function gtag() {window.dataLayer.push(arguments)}
  924. gtag('js', new Date())
  925. gtag('config', 'UA-132747866-1')
  926. </script>
  927. </body>
  928. </html>