index.html 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089
  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.5">
  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://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous"><!-- Documentation extras -->
  13. <link href="https://cdn.jsdelivr.net/npm/docsearch.js@2/dist/cdn/docsearch.min.css" rel="stylesheet">
  14. <link href="/assets/css/docs.min.css" rel="stylesheet">
  15. <link href="/assets/css/style.css?m=9" rel="stylesheet">
  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.20.2
  79. </a>
  80. <div class="dropdown-menu dropdown-menu-md-right" aria-labelledby="bd-versions">
  81. <a class="dropdown-item active" href="/">Latest (1.20.2)</a>
  82. <a class="dropdown-item" href="http://bootstrap-table.com/versions/1.19.1/" target="_blank">v1.19.1</a>
  83. <a class="dropdown-item" href="http://bootstrap-table.com/versions/1.18.3/" target="_blank">v1.18.3</a>
  84. <a class="dropdown-item" href="http://bootstrap-table.com/versions/1.17.1/" target="_blank">v1.17.1</a>
  85. <a class="dropdown-item" href="http://bootstrap-table.com/versions/1.16.0/" target="_blank">v1.16.0</a>
  86. <a class="dropdown-item" href="http://bootstrap-table.com/versions/1.15.5/" target="_blank">v1.15.5</a>
  87. </div>
  88. </li>
  89. <li class="nav-item">
  90. <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>
  91. </a>
  92. </li>
  93. <li class="nav-item">
  94. <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>
  95. </a>
  96. </li>
  97. <li class="nav-item">
  98. <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>
  99. </a>
  100. </li>
  101. </ul>
  102. <a class="btn btn-bd-download d-none d-lg-inline-block mb-3 mb-md-0 ml-md-3"
  103. href="/docs/getting-started/download/">Download</a>
  104. </header>
  105. <div class="container-fluid">
  106. <div class="row flex-xl-nowrap">
  107. <div class="col-12 col-md-3 col-xl-2 bd-sidebar">
  108. <form class="bd-search d-flex align-items-center">
  109. <input type="search" class="form-control"
  110. id="search-input" placeholder="Search..."
  111. aria-label="Search for..." autocomplete="off">
  112. <button class="btn btn-link bd-search-docs-toggle d-md-none p-0 ml-3"
  113. type="button" data-toggle="collapse" data-target="#bd-docs-nav"
  114. aria-controls="bd-docs-nav" aria-expanded="false"
  115. 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>
  116. </button>
  117. </form>
  118. <nav class="collapse bd-links" id="bd-docs-nav"><div class="bd-toc-item">
  119. <a class="bd-toc-link" href="/docs/getting-started/introduction/">
  120. Getting started
  121. </a>
  122. <ul class="nav bd-sidenav"><li>
  123. <a href="/docs/getting-started/introduction/">
  124. Introduction
  125. </a>
  126. </li><li>
  127. <a href="/docs/getting-started/download/">
  128. Download
  129. </a>
  130. </li><li>
  131. <a href="/docs/getting-started/contents/">
  132. Contents
  133. </a>
  134. </li><li>
  135. <a href="/docs/getting-started/usage/">
  136. Usage
  137. </a>
  138. </li><li>
  139. <a href="/docs/getting-started/browsers-devices/">
  140. Browsers & devices
  141. </a>
  142. </li><li>
  143. <a href="/docs/getting-started/build-tools/">
  144. Build tools
  145. </a>
  146. </li></ul>
  147. </div><div class="bd-toc-item active">
  148. <a class="bd-toc-link" href="/docs/api/table-options/">
  149. API
  150. </a>
  151. <ul class="nav bd-sidenav"><li>
  152. <a href="/docs/api/table-options/">
  153. Table Options
  154. </a>
  155. </li><li>
  156. <a href="/docs/api/column-options/">
  157. Column Options
  158. </a>
  159. </li><li class="active bd-sidenav-active">
  160. <a href="/docs/api/events/">
  161. Events
  162. </a>
  163. </li><li>
  164. <a href="/docs/api/methods/">
  165. Methods
  166. </a>
  167. </li><li>
  168. <a href="/docs/api/localizations/">
  169. Localizations
  170. </a>
  171. </li></ul>
  172. </div><div class="bd-toc-item">
  173. <a class="bd-toc-link" href="/docs/extensions/addrbar/">
  174. Extensions
  175. </a>
  176. <ul class="nav bd-sidenav"><li>
  177. <a href="/docs/extensions/addrbar/">
  178. Addrbar
  179. </a>
  180. </li><li>
  181. <a href="/docs/extensions/auto-refresh/">
  182. Auto Refresh
  183. </a>
  184. </li><li>
  185. <a href="/docs/extensions/cookie/">
  186. Cookie
  187. </a>
  188. </li><li>
  189. <a href="/docs/extensions/copy-rows/">
  190. Copy Rows
  191. </a>
  192. </li><li>
  193. <a href="/docs/extensions/custom-view/">
  194. Custom View
  195. </a>
  196. </li><li>
  197. <a href="/docs/extensions/defer-url/">
  198. Defer URL
  199. </a>
  200. </li><li>
  201. <a href="/docs/extensions/editable/">
  202. Editable
  203. </a>
  204. </li><li>
  205. <a href="/docs/extensions/export/">
  206. Export
  207. </a>
  208. </li><li>
  209. <a href="/docs/extensions/filter-control/">
  210. Filter Control
  211. </a>
  212. </li><li>
  213. <a href="/docs/extensions/fixed-columns/">
  214. Fixed Columns
  215. </a>
  216. </li><li>
  217. <a href="/docs/extensions/group-by-v2/">
  218. Group By v2
  219. </a>
  220. </li><li>
  221. <a href="/docs/extensions/i18n-enhance/">
  222. i18n Enhance
  223. </a>
  224. </li><li>
  225. <a href="/docs/extensions/key-events/">
  226. Key Events
  227. </a>
  228. </li><li>
  229. <a href="/docs/extensions/mobile/">
  230. Mobile
  231. </a>
  232. </li><li>
  233. <a href="/docs/extensions/multiple-sort/">
  234. Multiple Sort
  235. </a>
  236. </li><li>
  237. <a href="/docs/extensions/page-jump-to/">
  238. Page Jump To
  239. </a>
  240. </li><li>
  241. <a href="/docs/extensions/pipeline/">
  242. Pipeline
  243. </a>
  244. </li><li>
  245. <a href="/docs/extensions/print/">
  246. Print
  247. </a>
  248. </li><li>
  249. <a href="/docs/extensions/reorder-columns/">
  250. Reorder Columns
  251. </a>
  252. </li><li>
  253. <a href="/docs/extensions/reorder-rows/">
  254. Reorder Rows
  255. </a>
  256. </li><li>
  257. <a href="/docs/extensions/resizable/">
  258. Resizable
  259. </a>
  260. </li><li>
  261. <a href="/docs/extensions/sticky-header/">
  262. Sticky Header
  263. </a>
  264. </li><li>
  265. <a href="/docs/extensions/toolbar/">
  266. Toolbar
  267. </a>
  268. </li><li>
  269. <a href="/docs/extensions/treegrid/">
  270. Treegrid
  271. </a>
  272. </li></ul>
  273. </div><div class="bd-toc-item">
  274. <a class="bd-toc-link" href="/docs/vuejs/introduction/">
  275. VueJS
  276. </a>
  277. <ul class="nav bd-sidenav"><li>
  278. <a href="/docs/vuejs/introduction/">
  279. Introduction
  280. </a>
  281. </li><li>
  282. <a href="/docs/vuejs/browser/">
  283. Browser
  284. </a>
  285. </li><li>
  286. <a href="/docs/vuejs/webpack/">
  287. Webpack
  288. </a>
  289. </li><li>
  290. <a href="/docs/vuejs/component/">
  291. Component
  292. </a>
  293. </li></ul>
  294. </div><div class="bd-toc-item">
  295. <a class="bd-toc-link" href="/docs/online-editor/">
  296. Online Editor
  297. </a>
  298. <ul class="nav bd-sidenav"></ul>
  299. </div><div class="bd-toc-item">
  300. <a class="bd-toc-link" href="/docs/faq/">
  301. FAQ
  302. </a>
  303. <ul class="nav bd-sidenav"></ul>
  304. </div><div class="bd-toc-item">
  305. <a class="bd-toc-link" href="/docs/about/overview/">
  306. About
  307. </a>
  308. <ul class="nav bd-sidenav"><li>
  309. <a href="/docs/about/overview/">
  310. Overview
  311. </a>
  312. </li><li>
  313. <a href="/docs/about/team/">
  314. Team
  315. </a>
  316. </li><li>
  317. <a href="/docs/about/license/">
  318. License
  319. </a>
  320. </li><li>
  321. <a href="/docs/about/translations/">
  322. Translations
  323. </a>
  324. </li></ul>
  325. </div></nav>
  326. </div>
  327. <div class="d-none d-xl-block col-xl-2 bd-toc">
  328. <ul class="section-nav">
  329. <li class="toc-entry toc-h2"><a href="#onall">onAll</a></li>
  330. <li class="toc-entry toc-h2"><a href="#oncheck">onCheck</a></li>
  331. <li class="toc-entry toc-h2"><a href="#oncheckall">onCheckAll</a></li>
  332. <li class="toc-entry toc-h2"><a href="#onchecksome">onCheckSome</a></li>
  333. <li class="toc-entry toc-h2"><a href="#onclickcell">onClickCell</a></li>
  334. <li class="toc-entry toc-h2"><a href="#onclickrow">onClickRow</a></li>
  335. <li class="toc-entry toc-h2"><a href="#oncollapserow">onCollapseRow</a></li>
  336. <li class="toc-entry toc-h2"><a href="#oncolumnswitch">onColumnSwitch</a></li>
  337. <li class="toc-entry toc-h2"><a href="#oncolumnswitchall">onColumnSwitchAll</a></li>
  338. <li class="toc-entry toc-h2"><a href="#ondblclickcell">onDblClickCell</a></li>
  339. <li class="toc-entry toc-h2"><a href="#ondblclickrow">onDblClickRow</a></li>
  340. <li class="toc-entry toc-h2"><a href="#onexpandrow">onExpandRow</a></li>
  341. <li class="toc-entry toc-h2"><a href="#onloaderror">onLoadError</a></li>
  342. <li class="toc-entry toc-h2"><a href="#onloadsuccess">onLoadSuccess</a></li>
  343. <li class="toc-entry toc-h2"><a href="#onpagechange">onPageChange</a></li>
  344. <li class="toc-entry toc-h2"><a href="#onpostbody">onPostBody</a></li>
  345. <li class="toc-entry toc-h2"><a href="#onpostfooter">onPostFooter</a></li>
  346. <li class="toc-entry toc-h2"><a href="#onpostheader">onPostHeader</a></li>
  347. <li class="toc-entry toc-h2"><a href="#onprebody">onPreBody</a></li>
  348. <li class="toc-entry toc-h2"><a href="#onrefresh">onRefresh</a></li>
  349. <li class="toc-entry toc-h2"><a href="#onrefreshoptions">onRefreshOptions</a></li>
  350. <li class="toc-entry toc-h2"><a href="#onresetview">onResetView</a></li>
  351. <li class="toc-entry toc-h2"><a href="#onscrollbody">onScrollBody</a></li>
  352. <li class="toc-entry toc-h2"><a href="#onsearch">onSearch</a></li>
  353. <li class="toc-entry toc-h2"><a href="#onsort">onSort</a></li>
  354. <li class="toc-entry toc-h2"><a href="#ontoggle">onToggle</a></li>
  355. <li class="toc-entry toc-h2"><a href="#ontogglepagination">onTogglePagination</a></li>
  356. <li class="toc-entry toc-h2"><a href="#onuncheck">onUncheck</a></li>
  357. <li class="toc-entry toc-h2"><a href="#onuncheckall">onUncheckAll</a></li>
  358. <li class="toc-entry toc-h2"><a href="#onunchecksome">onUncheckSome</a></li>
  359. <li class="toc-entry toc-h2"><a href="#onvirtualscroll">onVirtualScroll</a></li>
  360. </ul>
  361. </div>
  362. <main class="col-12 col-md-9 col-xl-8 py-md-3 pl-md-5 bd-content api" role="main">
  363. <div class="d-md-flex flex-md-row-reverse align-items-center justify-content-between">
  364. <a class="btn btn-sm btn-bd-light mb-2 mb-md-0"
  365. href="https://github.com/wenzhixin/bootstrap-table/blob/develop/site/docs/api/events.md"
  366. title="View and edit this file on GitHub" target="_blank" rel="noopener">
  367. View on GitHub
  368. </a>
  369. <h1 class="bd-title" id="content">
  370. Events
  371. </h1>
  372. </div>
  373. <p class="bd-lead">The Events API of Bootstrap Table.</p>
  374. <div id="gg"></div>
  375. <p>Events can be bound in two ways:</p>
  376. <ul>
  377. <li>via the option object</li>
  378. <li>via jquery event handler</li>
  379. </ul>
  380. <p>Binding via the options object:</p>
  381. <figure class="highlight"><pre><code class="language-html" data-lang="html">// Here, you can expect to have as the last parameter the boostrap-table object
  382. $('#table').bootstrapTable({
  383. onEventName: function (arg1, arg2, ...) {
  384. // ...
  385. }
  386. })</code></pre></figure>
  387. <p>Binding via the jquery event handler:</p>
  388. <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 boostrap-table object
  389. $('#table').on('event-name.bs.table', function (e, arg1, arg2, ...) {
  390. // ...
  391. })</code></pre></figure>
  392. <p><em>Hint: if you use the jquery event handler, make sure to bind the event listener before the event is executed!</em></p>
  393. <h2 id="onall">onAll</h2>
  394. <ul>
  395. <li>
  396. <p><strong>jQuery Event:</strong> <code class="highlighter-rouge">all.bs.table</code></p>
  397. </li>
  398. <li>
  399. <p><strong>Parameter:</strong> <code class="highlighter-rouge">name, args</code></p>
  400. </li>
  401. <li>
  402. <p><strong>Detail:</strong></p>
  403. <p>It fires when all events trigger. The parameters contain:</p>
  404. <ul>
  405. <li><code class="highlighter-rouge">name</code>: the event name,</li>
  406. <li><code class="highlighter-rouge">args</code>: the event data.</li>
  407. </ul>
  408. </li>
  409. </ul>
  410. <h2 id="oncheck">onCheck</h2>
  411. <ul>
  412. <li>
  413. <p><strong>jQuery Event:</strong> <code class="highlighter-rouge">check.bs.table</code></p>
  414. </li>
  415. <li>
  416. <p><strong>Parameter:</strong> <code class="highlighter-rouge">row, $element</code></p>
  417. </li>
  418. <li>
  419. <p><strong>Detail:</strong></p>
  420. <p>It fires when the user checks a row. The parameters contain:</p>
  421. <ul>
  422. <li><code class="highlighter-rouge">row</code>: the record corresponding to the clicked row.</li>
  423. <li><code class="highlighter-rouge">$element</code>: the DOM element checked.</li>
  424. </ul>
  425. </li>
  426. </ul>
  427. <h2 id="oncheckall">onCheckAll</h2>
  428. <ul>
  429. <li>
  430. <p><strong>jQuery Event:</strong> <code class="highlighter-rouge">check-all.bs.table</code></p>
  431. </li>
  432. <li>
  433. <p><strong>Parameter:</strong> <code class="highlighter-rouge">rowsAfter, rowsBefore</code></p>
  434. </li>
  435. <li>
  436. <p><strong>Detail:</strong></p>
  437. <p>It fires when the user checks all rows. The parameters contain:</p>
  438. <ul>
  439. <li><code class="highlighter-rouge">rowsAfter</code>: array of records of the now checked rows.</li>
  440. <li><code class="highlighter-rouge">rowsBefore</code>: array of records of the checked rows before.</li>
  441. </ul>
  442. </li>
  443. </ul>
  444. <h2 id="onchecksome">onCheckSome</h2>
  445. <ul>
  446. <li>
  447. <p><strong>jQuery Event:</strong> <code class="highlighter-rouge">check-some.bs.table</code></p>
  448. </li>
  449. <li>
  450. <p><strong>Parameter:</strong> <code class="highlighter-rouge">rows</code></p>
  451. </li>
  452. <li>
  453. <p><strong>Detail:</strong></p>
  454. <p>It fires when the user checks some rows. The parameters contain:</p>
  455. <ul>
  456. <li><code class="highlighter-rouge">rows</code>: array of records corresponding to newly checked rows.</li>
  457. </ul>
  458. </li>
  459. </ul>
  460. <h2 id="onclickcell">onClickCell</h2>
  461. <ul>
  462. <li>
  463. <p><strong>jQuery Event:</strong> <code class="highlighter-rouge">click-cell.bs.table</code></p>
  464. </li>
  465. <li>
  466. <p><strong>Parameter:</strong> <code class="highlighter-rouge">field, value, row, $element</code></p>
  467. </li>
  468. <li>
  469. <p><strong>Detail:</strong></p>
  470. <p>It fires when the user clicks a cell. The parameters contain:</p>
  471. <ul>
  472. <li><code class="highlighter-rouge">field</code>: the field name corresponding to the clicked cell.</li>
  473. <li><code class="highlighter-rouge">value</code>: the data value corresponding to the clicked cell.</li>
  474. <li><code class="highlighter-rouge">row</code>: the record corresponding to the clicked row.</li>
  475. <li><code class="highlighter-rouge">$element</code>: the td element.</li>
  476. </ul>
  477. </li>
  478. </ul>
  479. <h2 id="onclickrow">onClickRow</h2>
  480. <ul>
  481. <li>
  482. <p><strong>jQuery Event:</strong> <code class="highlighter-rouge">click-row.bs.table</code></p>
  483. </li>
  484. <li>
  485. <p><strong>Parameter:</strong> <code class="highlighter-rouge">row, $element, field</code></p>
  486. </li>
  487. <li>
  488. <p><strong>Detail:</strong></p>
  489. <p>It fires when the user clicks a row. The parameters contain:</p>
  490. <ul>
  491. <li><code class="highlighter-rouge">row</code>: the record corresponding to the clicked row.</li>
  492. <li><code class="highlighter-rouge">$element</code>: the tr element.</li>
  493. <li><code class="highlighter-rouge">field</code>: the field name corresponding to the clicked cell.</li>
  494. </ul>
  495. </li>
  496. </ul>
  497. <h2 id="oncollapserow">onCollapseRow</h2>
  498. <ul>
  499. <li>
  500. <p><strong>jQuery Event:</strong> <code class="highlighter-rouge">collapse-row.bs.table</code></p>
  501. </li>
  502. <li>
  503. <p><strong>Parameter:</strong> <code class="highlighter-rouge">index, row, detailView</code></p>
  504. </li>
  505. <li>
  506. <p><strong>Detail:</strong></p>
  507. <p>It fires when you click the detail icon to collapse the detail view. The parameters contain:</p>
  508. <ul>
  509. <li><code class="highlighter-rouge">index</code>: the index of the collapsed row.</li>
  510. <li><code class="highlighter-rouge">row</code>: the record corresponding to the collapsed row.</li>
  511. <li><code class="highlighter-rouge">detailView</code>: the collapsed detailView.</li>
  512. </ul>
  513. </li>
  514. </ul>
  515. <h2 id="oncolumnswitch">onColumnSwitch</h2>
  516. <ul>
  517. <li>
  518. <p><strong>jQuery Event:</strong> <code class="highlighter-rouge">column-switch.bs.table</code></p>
  519. </li>
  520. <li>
  521. <p><strong>Parameter:</strong> <code class="highlighter-rouge">field, checked</code></p>
  522. </li>
  523. <li>
  524. <p><strong>Detail:</strong></p>
  525. <p>It fires when switch the column visible (<a href="/docs/api/table-options/#showcolumns">showColumns</a>). The parameters contain:</p>
  526. <ul>
  527. <li><code class="highlighter-rouge">field</code>: the field name corresponding to the switch column.</li>
  528. <li><code class="highlighter-rouge">checked</code>: the checked state of the column.</li>
  529. </ul>
  530. </li>
  531. </ul>
  532. <h2 id="oncolumnswitchall">onColumnSwitchAll</h2>
  533. <ul>
  534. <li>
  535. <p><strong>jQuery Event:</strong> <code class="highlighter-rouge">column-switch-all.bs.table</code></p>
  536. </li>
  537. <li>
  538. <p><strong>Parameter:</strong> <code class="highlighter-rouge">checked</code></p>
  539. </li>
  540. <li>
  541. <p><strong>Detail:</strong></p>
  542. <p>It fires when toogle all columns. The parameters contain:</p>
  543. <ul>
  544. <li><code class="highlighter-rouge">checked</code>: the checked state of the column.</li>
  545. </ul>
  546. </li>
  547. </ul>
  548. <h2 id="ondblclickcell">onDblClickCell</h2>
  549. <ul>
  550. <li>
  551. <p><strong>jQuery Event:</strong> <code class="highlighter-rouge">dbl-click-cell.bs.table</code></p>
  552. </li>
  553. <li>
  554. <p><strong>Parameter:</strong> <code class="highlighter-rouge">field, value, row, $element</code></p>
  555. </li>
  556. <li>
  557. <p><strong>Detail:</strong></p>
  558. <p>It fires when the user double click a cell. The parameters contain:</p>
  559. <ul>
  560. <li><code class="highlighter-rouge">field</code>: the field name corresponding to the clicked cell.</li>
  561. <li><code class="highlighter-rouge">value</code>: the data value corresponding to the clicked cell.</li>
  562. <li><code class="highlighter-rouge">row</code>: the record corresponding to the clicked row.</li>
  563. <li><code class="highlighter-rouge">$element</code>: the td element.</li>
  564. </ul>
  565. </li>
  566. </ul>
  567. <h2 id="ondblclickrow">onDblClickRow</h2>
  568. <ul>
  569. <li>
  570. <p><strong>jQuery Event:</strong> <code class="highlighter-rouge">dbl-click-row.bs.table</code></p>
  571. </li>
  572. <li>
  573. <p><strong>Parameter:</strong> <code class="highlighter-rouge">row, $element, field</code></p>
  574. </li>
  575. <li>
  576. <p><strong>Detail:</strong></p>
  577. <p>It fires when the user doubles click a row. The parameters contain:</p>
  578. <ul>
  579. <li><code class="highlighter-rouge">row</code>: the record corresponding to the clicked row.</li>
  580. <li><code class="highlighter-rouge">$element</code>: the tr element.</li>
  581. <li><code class="highlighter-rouge">field</code>: the field name corresponding to the clicked cell.</li>
  582. </ul>
  583. </li>
  584. </ul>
  585. <h2 id="onexpandrow">onExpandRow</h2>
  586. <ul>
  587. <li>
  588. <p><strong>jQuery Event:</strong> <code class="highlighter-rouge">expand-row.bs.table</code></p>
  589. </li>
  590. <li>
  591. <p><strong>Parameter:</strong> <code class="highlighter-rouge">index, row, $detail</code></p>
  592. </li>
  593. <li>
  594. <p><strong>Detail:</strong></p>
  595. <p>It fires when you click the detail icon to expand the detail view. The parameters contain:</p>
  596. <ul>
  597. <li><code class="highlighter-rouge">index</code>: the index of the expanded row.</li>
  598. <li><code class="highlighter-rouge">row</code>: the record corresponding to the expanded row.</li>
  599. <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>
  600. </ul>
  601. </li>
  602. </ul>
  603. <h2 id="onloaderror">onLoadError</h2>
  604. <ul>
  605. <li>
  606. <p><strong>jQuery Event:</strong> <code class="highlighter-rouge">load-error.bs.table</code></p>
  607. </li>
  608. <li>
  609. <p><strong>Parameter:</strong> <code class="highlighter-rouge">status, jqXHR</code></p>
  610. </li>
  611. <li>
  612. <p><strong>Detail:</strong></p>
  613. <p>It fires when some errors occur to load remote data. The parameters contain:</p>
  614. <ul>
  615. <li><code class="highlighter-rouge">status</code>: the status code of <code class="highlighter-rouge">jqXHR</code>.</li>
  616. <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>
  617. </ul>
  618. </li>
  619. </ul>
  620. <h2 id="onloadsuccess">onLoadSuccess</h2>
  621. <ul>
  622. <li>
  623. <p><strong>jQuery Event:</strong> <code class="highlighter-rouge">load-success.bs.table</code></p>
  624. </li>
  625. <li>
  626. <p><strong>Parameter:</strong> <code class="highlighter-rouge">data</code></p>
  627. </li>
  628. <li>
  629. <p><strong>Detail:</strong></p>
  630. <p>It fires when remote data is loaded successfully. The parameters contain:</p>
  631. <ul>
  632. <li><code class="highlighter-rouge">data</code>: the remote data.</li>
  633. <li><code class="highlighter-rouge">status</code>: the status code of <code class="highlighter-rouge">jqXHR</code>.</li>
  634. <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>
  635. </ul>
  636. </li>
  637. </ul>
  638. <h2 id="onpagechange">onPageChange</h2>
  639. <ul>
  640. <li>
  641. <p><strong>jQuery Event:</strong> <code class="highlighter-rouge">page-change.bs.table</code></p>
  642. </li>
  643. <li>
  644. <p><strong>Parameter:</strong> <code class="highlighter-rouge">number, size</code></p>
  645. </li>
  646. <li>
  647. <p><strong>Detail:</strong></p>
  648. <p>It fires when changing the page number or page size. The parameters contain:</p>
  649. <ul>
  650. <li><code class="highlighter-rouge">number</code>: the page number.</li>
  651. <li><code class="highlighter-rouge">size</code>: the page size.</li>
  652. </ul>
  653. </li>
  654. </ul>
  655. <h2 id="onpostbody">onPostBody</h2>
  656. <ul>
  657. <li>
  658. <p><strong>jQuery Event:</strong> <code class="highlighter-rouge">post-body.bs.table</code></p>
  659. </li>
  660. <li>
  661. <p><strong>Parameter:</strong> <code class="highlighter-rouge">data</code></p>
  662. </li>
  663. <li>
  664. <p><strong>Detail:</strong></p>
  665. <p>It fires after the table body are rendered and available in the DOM. The parameters contain:</p>
  666. <ul>
  667. <li><code class="highlighter-rouge">data</code>: the rendered data.</li>
  668. </ul>
  669. </li>
  670. </ul>
  671. <h2 id="onpostfooter">onPostFooter</h2>
  672. <ul>
  673. <li>
  674. <p><strong>jQuery Event:</strong> <code class="highlighter-rouge">post-footer.bs.table</code></p>
  675. </li>
  676. <li>
  677. <p><strong>Parameter:</strong> <code class="highlighter-rouge">$tableFooter</code></p>
  678. </li>
  679. <li>
  680. <p><strong>Detail:</strong></p>
  681. <p>It fires after the footer are rendered and available in the DOM. The parameters contain:</p>
  682. <ul>
  683. <li><code class="highlighter-rouge">$tableFooter</code>: the DOM element of the footer.</li>
  684. </ul>
  685. </li>
  686. </ul>
  687. <h2 id="onpostheader">onPostHeader</h2>
  688. <ul>
  689. <li>
  690. <p><strong>jQuery Event:</strong> <code class="highlighter-rouge">post-header.bs.table</code></p>
  691. </li>
  692. <li>
  693. <p><strong>Parameter:</strong> <code class="highlighter-rouge">undefined</code></p>
  694. </li>
  695. <li>
  696. <p><strong>Detail:</strong></p>
  697. <p>It fires after the table header is rendered and available in the DOM.</p>
  698. </li>
  699. </ul>
  700. <h2 id="onprebody">onPreBody</h2>
  701. <ul>
  702. <li>
  703. <p><strong>jQuery Event:</strong> <code class="highlighter-rouge">pre-body.bs.table</code></p>
  704. </li>
  705. <li>
  706. <p><strong>Parameter:</strong> <code class="highlighter-rouge">data</code></p>
  707. </li>
  708. <li>
  709. <p><strong>Detail:</strong></p>
  710. <p>It fires before the table body are rendered. The parameters contain:</p>
  711. <ul>
  712. <li><code class="highlighter-rouge">data</code>: the rendered data.</li>
  713. </ul>
  714. </li>
  715. </ul>
  716. <h2 id="onrefresh">onRefresh</h2>
  717. <ul>
  718. <li>
  719. <p><strong>jQuery Event:</strong> <code class="highlighter-rouge">refresh.bs.table</code></p>
  720. </li>
  721. <li>
  722. <p><strong>Parameter:</strong> <code class="highlighter-rouge">params</code></p>
  723. </li>
  724. <li>
  725. <p><strong>Detail:</strong></p>
  726. <p>It fires after the click of the refresh button. The parameters contain:</p>
  727. <ul>
  728. <li><code class="highlighter-rouge">params</code>: the additional parameters request to the server.</li>
  729. </ul>
  730. </li>
  731. </ul>
  732. <h2 id="onrefreshoptions">onRefreshOptions</h2>
  733. <ul>
  734. <li>
  735. <p><strong>jQuery Event:</strong> <code class="highlighter-rouge">refresh-options.bs.table</code></p>
  736. </li>
  737. <li>
  738. <p><strong>Parameter:</strong> <code class="highlighter-rouge">options</code></p>
  739. </li>
  740. <li>
  741. <p><strong>Detail:</strong></p>
  742. <p>It fires after refreshing the options, and before destroying and init the table. The parameters contain:</p>
  743. <ul>
  744. <li><code class="highlighter-rouge">options</code>: the table options object.</li>
  745. </ul>
  746. </li>
  747. </ul>
  748. <h2 id="onresetview">onResetView</h2>
  749. <ul>
  750. <li>
  751. <p><strong>jQuery Event:</strong> <code class="highlighter-rouge">reset-view.bs.table</code></p>
  752. </li>
  753. <li>
  754. <p><strong>Parameter:</strong> <code class="highlighter-rouge">undefined</code></p>
  755. </li>
  756. <li>
  757. <p><strong>Detail:</strong></p>
  758. <p>It fires when resetting the view of the table.</p>
  759. </li>
  760. </ul>
  761. <h2 id="onscrollbody">onScrollBody</h2>
  762. <ul>
  763. <li>
  764. <p><strong>jQuery Event:</strong> <code class="highlighter-rouge">scroll-body.bs.table</code></p>
  765. </li>
  766. <li>
  767. <p><strong>Parameter:</strong> <code class="highlighter-rouge">$tableBody</code></p>
  768. </li>
  769. <li>
  770. <p><strong>Detail:</strong></p>
  771. <p>It fires when the table body scroll.</p>
  772. <h2 id="onsearch">onSearch</h2>
  773. </li>
  774. <li>
  775. <p><strong>jQuery Event:</strong> <code class="highlighter-rouge">search.bs.table</code></p>
  776. </li>
  777. <li>
  778. <p><strong>Parameter:</strong> <code class="highlighter-rouge">text</code></p>
  779. </li>
  780. <li>
  781. <p><strong>Detail:</strong></p>
  782. <p>It fires when searching the table. The parameters contain:</p>
  783. <ul>
  784. <li><code class="highlighter-rouge">text</code>: the text of the search input.</li>
  785. </ul>
  786. </li>
  787. </ul>
  788. <h2 id="onsort">onSort</h2>
  789. <ul>
  790. <li>
  791. <p><strong>jQuery Event:</strong> <code class="highlighter-rouge">sort.bs.table</code></p>
  792. </li>
  793. <li>
  794. <p><strong>Parameter:</strong> <code class="highlighter-rouge">name, order</code></p>
  795. </li>
  796. <li>
  797. <p><strong>Detail:</strong></p>
  798. <p>It fires when the user sort a column. The parameters contain:</p>
  799. <ul>
  800. <li><code class="highlighter-rouge">name</code>: the sort column field name.</li>
  801. <li><code class="highlighter-rouge">order</code>: the sort column order.</li>
  802. </ul>
  803. </li>
  804. </ul>
  805. <h2 id="ontoggle">onToggle</h2>
  806. <ul>
  807. <li>
  808. <p><strong>jQuery Event:</strong> <code class="highlighter-rouge">toggle.bs.table</code></p>
  809. </li>
  810. <li>
  811. <p><strong>Parameter:</strong> <code class="highlighter-rouge">cardView</code></p>
  812. </li>
  813. <li>
  814. <p><strong>Detail:</strong></p>
  815. <p>It fires when toggling the view of the table. The parameters contain:</p>
  816. <ul>
  817. <li><code class="highlighter-rouge">cardView</code>: the cardView state of the table.</li>
  818. </ul>
  819. </li>
  820. </ul>
  821. <h2 id="ontogglepagination">onTogglePagination</h2>
  822. <ul>
  823. <li>
  824. <p><strong>jQuery Event:</strong> <code class="highlighter-rouge">toggle-pagination.bs.table</code></p>
  825. </li>
  826. <li>
  827. <p><strong>Parameter:</strong> <code class="highlighter-rouge">state</code></p>
  828. </li>
  829. <li>
  830. <p><strong>Detail:</strong></p>
  831. <p>It fires when the pagination is toggled:</p>
  832. <ul>
  833. <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>
  834. </ul>
  835. </li>
  836. </ul>
  837. <h2 id="onuncheck">onUncheck</h2>
  838. <ul>
  839. <li>
  840. <p><strong>jQuery Event:</strong> <code class="highlighter-rouge">uncheck.bs.table</code></p>
  841. </li>
  842. <li>
  843. <p><strong>Parameter:</strong> <code class="highlighter-rouge">row, $element</code></p>
  844. </li>
  845. <li>
  846. <p><strong>Detail:</strong></p>
  847. <p>It fires when the user unchecks a row. The parameters contain:</p>
  848. <ul>
  849. <li><code class="highlighter-rouge">row</code>: the record corresponding to the clicked row.</li>
  850. <li><code class="highlighter-rouge">$element</code>: the DOM element unchecked.</li>
  851. </ul>
  852. </li>
  853. </ul>
  854. <h2 id="onuncheckall">onUncheckAll</h2>
  855. <ul>
  856. <li>
  857. <p><strong>jQuery Event:</strong> <code class="highlighter-rouge">uncheck-all.bs.table</code></p>
  858. </li>
  859. <li>
  860. <p><strong>Parameter:</strong> <code class="highlighter-rouge">rowsAfter, rowsBefore</code></p>
  861. </li>
  862. <li>
  863. <p><strong>Detail:</strong></p>
  864. <p>It fires when the user unchecks all rows. The parameters contain:</p>
  865. <ul>
  866. <li><code class="highlighter-rouge">rowsAfter</code>: array of records of the now checked rows.</li>
  867. <li><code class="highlighter-rouge">rowsBefore</code>: array of records of the checked rows before.</li>
  868. </ul>
  869. </li>
  870. </ul>
  871. <h2 id="onunchecksome">onUncheckSome</h2>
  872. <ul>
  873. <li>
  874. <p><strong>jQuery Event:</strong> <code class="highlighter-rouge">uncheck-some.bs.table</code></p>
  875. </li>
  876. <li>
  877. <p><strong>Parameter:</strong> <code class="highlighter-rouge">rows</code></p>
  878. </li>
  879. <li>
  880. <p><strong>Detail:</strong></p>
  881. <p>It fires when the user unchecks some rows. The parameters contain:</p>
  882. <ul>
  883. <li><code class="highlighter-rouge">rows</code>: array of records corresponding to previously checked rows.</li>
  884. </ul>
  885. </li>
  886. </ul>
  887. <h2 id="onvirtualscroll">onVirtualScroll</h2>
  888. <ul>
  889. <li>
  890. <p><strong>jQuery Event:</strong> <code class="highlighter-rouge">virtual-scroll.bs.table</code></p>
  891. </li>
  892. <li>
  893. <p><strong>Parameter:</strong> <code class="highlighter-rouge">startIndex, endIndex</code></p>
  894. </li>
  895. <li>
  896. <p><strong>Detail:</strong></p>
  897. <p>It fires when the user scrolls the virtual scroll. The parameters contain:</p>
  898. <ul>
  899. <li><code class="highlighter-rouge">startIndex</code>: the start row index of the virtual scroll.</li>
  900. <li><code class="highlighter-rouge">endIndex</code>: the end row index of the virtual scroll.</li>
  901. </ul>
  902. </li>
  903. </ul>
  904. </main>
  905. </div>
  906. </div>
  907. <script src="https://cdn.jsdelivr.net/npm/jquery/dist/jquery.min.js"></script>
  908. <script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js"></script>
  909. <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
  910. <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>
  911. <script>
  912. $(function () {
  913. $('.bd-content.api a').attr('target', '_blank')
  914. })
  915. </script><script src="https://gg.wenzhixin.net.cn/bootstrap-table/gg.js"></script>
  916. <script src="/assets/js/docs.min.js?m=1"></script>
  917. <!-- Global site tag (gtag.js) - Google Analytics -->
  918. <script async src="https://www.googletagmanager.com/gtag/js?id=UA-132747866-1"></script>
  919. <script>
  920. window.dataLayer = window.dataLayer || []
  921. function gtag() {window.dataLayer.push(arguments)}
  922. gtag('js', new Date())
  923. gtag('config', 'UA-132747866-1')
  924. </script>
  925. </body>
  926. </html>