index.html 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515
  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="Table Pipeline extension 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>Table Pipeline · 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">
  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>
  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 active">
  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 class="active bd-sidenav-active">
  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="#usage">Usage</a></li>
  332. <li class="toc-entry toc-h2"><a href="#usage-1">Usage</a></li>
  333. <li class="toc-entry toc-h2"><a href="#example">Example</a></li>
  334. <li class="toc-entry toc-h2"><a href="#options">Options</a></li>
  335. <li class="toc-entry toc-h2"><a href="#pipelinesize">pipelineSize</a>
  336. <ul>
  337. <li class="toc-entry toc-h3"><a href="#usepipeline">usePipeline</a></li>
  338. </ul>
  339. </li>
  340. <li class="toc-entry toc-h2"><a href="#events">Events</a>
  341. <ul>
  342. <li class="toc-entry toc-h3"><a href="#oncacheddatahitcached-data-hitbstable">onCachedDataHit(cached-data-hit.bs.table)</a></li>
  343. <li class="toc-entry toc-h3"><a href="#oncacheddataresetcached-data-resetbstable">onCachedDataReset(cached-data-reset.bs.table)</a></li>
  344. </ul>
  345. </li>
  346. </ul>
  347. </div>
  348. <main class="col-12 col-md-9 col-xl-8 py-md-3 pl-md-5 bd-content extensions" role="main">
  349. <div class="d-md-flex flex-md-row-reverse align-items-center justify-content-between">
  350. <a class="btn btn-sm btn-bd-light mb-2 mb-md-0"
  351. href="https://github.com/wenzhixin/bootstrap-table/blob/develop/site/docs/extensions/pipeline.md"
  352. title="View and edit this file on GitHub" target="_blank" rel="noopener">
  353. View on GitHub
  354. </a>
  355. <h1 class="bd-title" id="content">
  356. Table Pipeline
  357. </h1>
  358. </div>
  359. <p class="bd-lead">Table Pipeline extension of Bootstrap Table.</p>
  360. <div id="gg"></div>
  361. <p>This plugin enables client-side data caching for server-side requests which will
  362. eliminate the need to issue a new request every page change. This will allow
  363. for a performance balance for a large data set between returning all data at once
  364. (client-side paging) and a new server-side request (server-side paging).</p>
  365. <p>There are two new options:</p>
  366. <ul>
  367. <li><code class="highlighter-rouge">usePipeline</code>: enables this feature</li>
  368. <li><code class="highlighter-rouge">pipelineSize</code>: the size of each cache window</li>
  369. </ul>
  370. <p>The size of the pipeline must be evenly divisible by the current page size. This is
  371. assured by rounding up to the nearest evenly divisible value. For example, if
  372. the pipeline size is 4990 and the current page size is 25, then the pipeline size will
  373. be dynamically set to 5000.</p>
  374. <p>The cache windows are computed based on the pipeline size and the total number of rows
  375. returned by the server-side query. For example, with pipeline size 500 and total rows
  376. 1300, the cache windows will be:</p>
  377. <p>[{‘lower’: 0, ‘upper’: 499}, {‘lower’: 500, ‘upper’: 999}, {‘lower’: 1000, ‘upper’: 1499}]</p>
  378. <p>Using the limit (i.e. the <code class="highlighter-rouge">pipelineSize</code>) and offset parameters, the server-side request
  379. <strong>MUST</strong> return only the data in the requested cache window <strong>AND</strong> the total number of rows.
  380. To wit, the server-side code must use the offset and limit parameters to prepare the response
  381. data.</p>
  382. <p>On a page change, the new offset is checked if it is within the current cache window. If so,
  383. the requested page data is returned from the cached data set. Otherwise, a new server-side
  384. request will be issued for the new cache window.</p>
  385. <p>The current cached data is only invalidated on these events:</p>
  386. <ul>
  387. <li>sorting</li>
  388. <li>searching</li>
  389. <li>page size change</li>
  390. <li>page change moves into a new cache window</li>
  391. </ul>
  392. <p>There are two new events:</p>
  393. <ul>
  394. <li><code class="highlighter-rouge">cached-data-hit.bs.table</code>: issued when cached data is used on a page change</li>
  395. <li><code class="highlighter-rouge">cached-data-reset.bs.table</code>: issued when the cached data is invalidated and the new server-side request is issued</li>
  396. </ul>
  397. <h2 id="usage">Usage</h2>
  398. <figure class="highlight"><pre><code class="language-html" data-lang="html"><span class="nt">&lt;script </span><span class="na">src=</span><span class="s">"extensions/pipeline/bootstrap-table-pipeline.js"</span><span class="nt">&gt;&lt;/script&gt;</span></code></pre></figure>
  399. <h2 id="usage-1">Usage</h2>
  400. <h2 id="example">Example</h2>
  401. <p><a href="https://examples.bootstrap-table.com/#extensions/pipeline.html">Pipeline</a></p>
  402. <h2 id="options">Options</h2>
  403. <h2 id="pipelinesize">pipelineSize</h2>
  404. <ul>
  405. <li>type: Number</li>
  406. <li>description: Size of each cache window. Must be greater than 0.</li>
  407. <li>default: <code class="highlighter-rouge">1000</code></li>
  408. </ul>
  409. <h3 id="usepipeline">usePipeline</h3>
  410. <ul>
  411. <li>type: Boolean</li>
  412. <li>description: Set true to enable pipelining</li>
  413. <li>default: <code class="highlighter-rouge">false</code></li>
  414. </ul>
  415. <h2 id="events">Events</h2>
  416. <h3 id="oncacheddatahitcached-data-hitbstable">onCachedDataHit(cached-data-hit.bs.table)</h3>
  417. <ul>
  418. <li>Fires when paging can use the locally cached data.</li>
  419. </ul>
  420. <h3 id="oncacheddataresetcached-data-resetbstable">onCachedDataReset(cached-data-reset.bs.table)</h3>
  421. <ul>
  422. <li>Fires when the locally cached data needs to be reset (i.e. on sorting, searching, page size change or page out of the current cache window).</li>
  423. </ul>
  424. </main>
  425. </div>
  426. </div>
  427. <script src="https://cdn.jsdelivr.net/npm/jquery/dist/jquery.min.js"></script>
  428. <script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.1/dist/umd/popper.min.js"></script>
  429. <script src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/js/bootstrap.min.js"></script>
  430. <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>
  431. <script>
  432. $(function () {
  433. $('.bd-content.api a').attr('target', '_blank')
  434. })
  435. </script><script src="https://gg.wenzhixin.net.cn/bootstrap-table/gg.js"></script>
  436. <script src="/assets/js/docs.min.js?m=1"></script>
  437. <!-- Global site tag (gtag.js) - Google Analytics -->
  438. <script async src="https://www.googletagmanager.com/gtag/js?id=UA-132747866-1"></script>
  439. <script>
  440. window.dataLayer = window.dataLayer || []
  441. function gtag() {window.dataLayer.push(arguments)}
  442. gtag('js', new Date())
  443. gtag('config', 'UA-132747866-1')
  444. </script>
  445. </body>
  446. </html>