multi_instance.html 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <link rel="shortcut icon" type="image/ico" href="http://www.datatables.net/favicon.ico">
  6. <meta name="viewport" content="initial-scale=1.0, maximum-scale=2.0">
  7. <title>TableTools example - Multiple toolbars</title>
  8. <link rel="stylesheet" type="text/css" href="../../../media/css/jquery.dataTables.css">
  9. <link rel="stylesheet" type="text/css" href="../css/dataTables.tableTools.css">
  10. <link rel="stylesheet" type="text/css" href="../../../examples/resources/syntax/shCore.css">
  11. <link rel="stylesheet" type="text/css" href="../../../examples/resources/demo.css">
  12. <style type="text/css" class="init">
  13. </style>
  14. <script type="text/javascript" language="javascript" src="../../../media/js/jquery.js"></script>
  15. <script type="text/javascript" language="javascript" src="../../../media/js/jquery.dataTables.js"></script>
  16. <script type="text/javascript" language="javascript" src="../js/dataTables.tableTools.js"></script>
  17. <script type="text/javascript" language="javascript" src="../../../examples/resources/syntax/shCore.js"></script>
  18. <script type="text/javascript" language="javascript" src="../../../examples/resources/demo.js"></script>
  19. <script type="text/javascript" language="javascript" class="init">
  20. $(document).ready(function() {
  21. $('#example').DataTable( {
  22. dom: 'T<"clear">lfrtip<"clear spacer">T',
  23. tableTools: {
  24. "aButtons": [ "copy", "print" ]
  25. }
  26. } );
  27. } );
  28. </script>
  29. </head>
  30. <body class="dt-example">
  31. <div class="container">
  32. <section>
  33. <h1>TableTools example <span>Multiple toolbars</span></h1>
  34. <div class="info">
  35. <p>Like all DataTables control elements, TableTools can have multiple instances specified in the <a href="//datatables.net/reference/option/dom"><code class=
  36. "option" title="DataTables initialisation option">dom<span>DT</span></code></a> parameter of DataTables. This will create two TableTools toolbars next to the
  37. table, providing the same functions.</p>
  38. <p>An example of when this might be useful is to show the toolbar both above and below the table - as is done in this example.</p>
  39. </div>
  40. <table id="example" class="display" cellspacing="0" width="100%">
  41. <thead>
  42. <tr>
  43. <th>Name</th>
  44. <th>Position</th>
  45. <th>Office</th>
  46. <th>Age</th>
  47. <th>Start date</th>
  48. <th>Salary</th>
  49. </tr>
  50. </thead>
  51. <tfoot>
  52. <tr>
  53. <th>Name</th>
  54. <th>Position</th>
  55. <th>Office</th>
  56. <th>Age</th>
  57. <th>Start date</th>
  58. <th>Salary</th>
  59. </tr>
  60. </tfoot>
  61. <tbody>
  62. <tr>
  63. <td>Tiger Nixon</td>
  64. <td>System Architect</td>
  65. <td>Edinburgh</td>
  66. <td>61</td>
  67. <td>2011/04/25</td>
  68. <td>$320,800</td>
  69. </tr>
  70. <tr>
  71. <td>Garrett Winters</td>
  72. <td>Accountant</td>
  73. <td>Tokyo</td>
  74. <td>63</td>
  75. <td>2011/07/25</td>
  76. <td>$170,750</td>
  77. </tr>
  78. <tr>
  79. <td>Ashton Cox</td>
  80. <td>Junior Technical Author</td>
  81. <td>San Francisco</td>
  82. <td>66</td>
  83. <td>2009/01/12</td>
  84. <td>$86,000</td>
  85. </tr>
  86. <tr>
  87. <td>Cedric Kelly</td>
  88. <td>Senior Javascript Developer</td>
  89. <td>Edinburgh</td>
  90. <td>22</td>
  91. <td>2012/03/29</td>
  92. <td>$433,060</td>
  93. </tr>
  94. <tr>
  95. <td>Airi Satou</td>
  96. <td>Accountant</td>
  97. <td>Tokyo</td>
  98. <td>33</td>
  99. <td>2008/11/28</td>
  100. <td>$162,700</td>
  101. </tr>
  102. <tr>
  103. <td>Brielle Williamson</td>
  104. <td>Integration Specialist</td>
  105. <td>New York</td>
  106. <td>61</td>
  107. <td>2012/12/02</td>
  108. <td>$372,000</td>
  109. </tr>
  110. <tr>
  111. <td>Herrod Chandler</td>
  112. <td>Sales Assistant</td>
  113. <td>San Francisco</td>
  114. <td>59</td>
  115. <td>2012/08/06</td>
  116. <td>$137,500</td>
  117. </tr>
  118. <tr>
  119. <td>Rhona Davidson</td>
  120. <td>Integration Specialist</td>
  121. <td>Tokyo</td>
  122. <td>55</td>
  123. <td>2010/10/14</td>
  124. <td>$327,900</td>
  125. </tr>
  126. <tr>
  127. <td>Colleen Hurst</td>
  128. <td>Javascript Developer</td>
  129. <td>San Francisco</td>
  130. <td>39</td>
  131. <td>2009/09/15</td>
  132. <td>$205,500</td>
  133. </tr>
  134. <tr>
  135. <td>Sonya Frost</td>
  136. <td>Software Engineer</td>
  137. <td>Edinburgh</td>
  138. <td>23</td>
  139. <td>2008/12/13</td>
  140. <td>$103,600</td>
  141. </tr>
  142. <tr>
  143. <td>Jena Gaines</td>
  144. <td>Office Manager</td>
  145. <td>London</td>
  146. <td>30</td>
  147. <td>2008/12/19</td>
  148. <td>$90,560</td>
  149. </tr>
  150. <tr>
  151. <td>Quinn Flynn</td>
  152. <td>Support Lead</td>
  153. <td>Edinburgh</td>
  154. <td>22</td>
  155. <td>2013/03/03</td>
  156. <td>$342,000</td>
  157. </tr>
  158. <tr>
  159. <td>Charde Marshall</td>
  160. <td>Regional Director</td>
  161. <td>San Francisco</td>
  162. <td>36</td>
  163. <td>2008/10/16</td>
  164. <td>$470,600</td>
  165. </tr>
  166. <tr>
  167. <td>Haley Kennedy</td>
  168. <td>Senior Marketing Designer</td>
  169. <td>London</td>
  170. <td>43</td>
  171. <td>2012/12/18</td>
  172. <td>$313,500</td>
  173. </tr>
  174. <tr>
  175. <td>Tatyana Fitzpatrick</td>
  176. <td>Regional Director</td>
  177. <td>London</td>
  178. <td>19</td>
  179. <td>2010/03/17</td>
  180. <td>$385,750</td>
  181. </tr>
  182. <tr>
  183. <td>Michael Silva</td>
  184. <td>Marketing Designer</td>
  185. <td>London</td>
  186. <td>66</td>
  187. <td>2012/11/27</td>
  188. <td>$198,500</td>
  189. </tr>
  190. <tr>
  191. <td>Paul Byrd</td>
  192. <td>Chief Financial Officer (CFO)</td>
  193. <td>New York</td>
  194. <td>64</td>
  195. <td>2010/06/09</td>
  196. <td>$725,000</td>
  197. </tr>
  198. <tr>
  199. <td>Gloria Little</td>
  200. <td>Systems Administrator</td>
  201. <td>New York</td>
  202. <td>59</td>
  203. <td>2009/04/10</td>
  204. <td>$237,500</td>
  205. </tr>
  206. <tr>
  207. <td>Bradley Greer</td>
  208. <td>Software Engineer</td>
  209. <td>London</td>
  210. <td>41</td>
  211. <td>2012/10/13</td>
  212. <td>$132,000</td>
  213. </tr>
  214. <tr>
  215. <td>Dai Rios</td>
  216. <td>Personnel Lead</td>
  217. <td>Edinburgh</td>
  218. <td>35</td>
  219. <td>2012/09/26</td>
  220. <td>$217,500</td>
  221. </tr>
  222. <tr>
  223. <td>Jenette Caldwell</td>
  224. <td>Development Lead</td>
  225. <td>New York</td>
  226. <td>30</td>
  227. <td>2011/09/03</td>
  228. <td>$345,000</td>
  229. </tr>
  230. <tr>
  231. <td>Yuri Berry</td>
  232. <td>Chief Marketing Officer (CMO)</td>
  233. <td>New York</td>
  234. <td>40</td>
  235. <td>2009/06/25</td>
  236. <td>$675,000</td>
  237. </tr>
  238. <tr>
  239. <td>Caesar Vance</td>
  240. <td>Pre-Sales Support</td>
  241. <td>New York</td>
  242. <td>21</td>
  243. <td>2011/12/12</td>
  244. <td>$106,450</td>
  245. </tr>
  246. <tr>
  247. <td>Doris Wilder</td>
  248. <td>Sales Assistant</td>
  249. <td>Sidney</td>
  250. <td>23</td>
  251. <td>2010/09/20</td>
  252. <td>$85,600</td>
  253. </tr>
  254. <tr>
  255. <td>Angelica Ramos</td>
  256. <td>Chief Executive Officer (CEO)</td>
  257. <td>London</td>
  258. <td>47</td>
  259. <td>2009/10/09</td>
  260. <td>$1,200,000</td>
  261. </tr>
  262. <tr>
  263. <td>Gavin Joyce</td>
  264. <td>Developer</td>
  265. <td>Edinburgh</td>
  266. <td>42</td>
  267. <td>2010/12/22</td>
  268. <td>$92,575</td>
  269. </tr>
  270. <tr>
  271. <td>Jennifer Chang</td>
  272. <td>Regional Director</td>
  273. <td>Singapore</td>
  274. <td>28</td>
  275. <td>2010/11/14</td>
  276. <td>$357,650</td>
  277. </tr>
  278. <tr>
  279. <td>Brenden Wagner</td>
  280. <td>Software Engineer</td>
  281. <td>San Francisco</td>
  282. <td>28</td>
  283. <td>2011/06/07</td>
  284. <td>$206,850</td>
  285. </tr>
  286. <tr>
  287. <td>Fiona Green</td>
  288. <td>Chief Operating Officer (COO)</td>
  289. <td>San Francisco</td>
  290. <td>48</td>
  291. <td>2010/03/11</td>
  292. <td>$850,000</td>
  293. </tr>
  294. <tr>
  295. <td>Shou Itou</td>
  296. <td>Regional Marketing</td>
  297. <td>Tokyo</td>
  298. <td>20</td>
  299. <td>2011/08/14</td>
  300. <td>$163,000</td>
  301. </tr>
  302. <tr>
  303. <td>Michelle House</td>
  304. <td>Integration Specialist</td>
  305. <td>Sidney</td>
  306. <td>37</td>
  307. <td>2011/06/02</td>
  308. <td>$95,400</td>
  309. </tr>
  310. <tr>
  311. <td>Suki Burks</td>
  312. <td>Developer</td>
  313. <td>London</td>
  314. <td>53</td>
  315. <td>2009/10/22</td>
  316. <td>$114,500</td>
  317. </tr>
  318. <tr>
  319. <td>Prescott Bartlett</td>
  320. <td>Technical Author</td>
  321. <td>London</td>
  322. <td>27</td>
  323. <td>2011/05/07</td>
  324. <td>$145,000</td>
  325. </tr>
  326. <tr>
  327. <td>Gavin Cortez</td>
  328. <td>Team Leader</td>
  329. <td>San Francisco</td>
  330. <td>22</td>
  331. <td>2008/10/26</td>
  332. <td>$235,500</td>
  333. </tr>
  334. <tr>
  335. <td>Martena Mccray</td>
  336. <td>Post-Sales support</td>
  337. <td>Edinburgh</td>
  338. <td>46</td>
  339. <td>2011/03/09</td>
  340. <td>$324,050</td>
  341. </tr>
  342. <tr>
  343. <td>Unity Butler</td>
  344. <td>Marketing Designer</td>
  345. <td>San Francisco</td>
  346. <td>47</td>
  347. <td>2009/12/09</td>
  348. <td>$85,675</td>
  349. </tr>
  350. <tr>
  351. <td>Howard Hatfield</td>
  352. <td>Office Manager</td>
  353. <td>San Francisco</td>
  354. <td>51</td>
  355. <td>2008/12/16</td>
  356. <td>$164,500</td>
  357. </tr>
  358. <tr>
  359. <td>Hope Fuentes</td>
  360. <td>Secretary</td>
  361. <td>San Francisco</td>
  362. <td>41</td>
  363. <td>2010/02/12</td>
  364. <td>$109,850</td>
  365. </tr>
  366. <tr>
  367. <td>Vivian Harrell</td>
  368. <td>Financial Controller</td>
  369. <td>San Francisco</td>
  370. <td>62</td>
  371. <td>2009/02/14</td>
  372. <td>$452,500</td>
  373. </tr>
  374. <tr>
  375. <td>Timothy Mooney</td>
  376. <td>Office Manager</td>
  377. <td>London</td>
  378. <td>37</td>
  379. <td>2008/12/11</td>
  380. <td>$136,200</td>
  381. </tr>
  382. <tr>
  383. <td>Jackson Bradshaw</td>
  384. <td>Director</td>
  385. <td>New York</td>
  386. <td>65</td>
  387. <td>2008/09/26</td>
  388. <td>$645,750</td>
  389. </tr>
  390. <tr>
  391. <td>Olivia Liang</td>
  392. <td>Support Engineer</td>
  393. <td>Singapore</td>
  394. <td>64</td>
  395. <td>2011/02/03</td>
  396. <td>$234,500</td>
  397. </tr>
  398. <tr>
  399. <td>Bruno Nash</td>
  400. <td>Software Engineer</td>
  401. <td>London</td>
  402. <td>38</td>
  403. <td>2011/05/03</td>
  404. <td>$163,500</td>
  405. </tr>
  406. <tr>
  407. <td>Sakura Yamamoto</td>
  408. <td>Support Engineer</td>
  409. <td>Tokyo</td>
  410. <td>37</td>
  411. <td>2009/08/19</td>
  412. <td>$139,575</td>
  413. </tr>
  414. <tr>
  415. <td>Thor Walton</td>
  416. <td>Developer</td>
  417. <td>New York</td>
  418. <td>61</td>
  419. <td>2013/08/11</td>
  420. <td>$98,540</td>
  421. </tr>
  422. <tr>
  423. <td>Finn Camacho</td>
  424. <td>Support Engineer</td>
  425. <td>San Francisco</td>
  426. <td>47</td>
  427. <td>2009/07/07</td>
  428. <td>$87,500</td>
  429. </tr>
  430. <tr>
  431. <td>Serge Baldwin</td>
  432. <td>Data Coordinator</td>
  433. <td>Singapore</td>
  434. <td>64</td>
  435. <td>2012/04/09</td>
  436. <td>$138,575</td>
  437. </tr>
  438. <tr>
  439. <td>Zenaida Frank</td>
  440. <td>Software Engineer</td>
  441. <td>New York</td>
  442. <td>63</td>
  443. <td>2010/01/04</td>
  444. <td>$125,250</td>
  445. </tr>
  446. <tr>
  447. <td>Zorita Serrano</td>
  448. <td>Software Engineer</td>
  449. <td>San Francisco</td>
  450. <td>56</td>
  451. <td>2012/06/01</td>
  452. <td>$115,000</td>
  453. </tr>
  454. <tr>
  455. <td>Jennifer Acosta</td>
  456. <td>Junior Javascript Developer</td>
  457. <td>Edinburgh</td>
  458. <td>43</td>
  459. <td>2013/02/01</td>
  460. <td>$75,650</td>
  461. </tr>
  462. <tr>
  463. <td>Cara Stevens</td>
  464. <td>Sales Assistant</td>
  465. <td>New York</td>
  466. <td>46</td>
  467. <td>2011/12/06</td>
  468. <td>$145,600</td>
  469. </tr>
  470. <tr>
  471. <td>Hermione Butler</td>
  472. <td>Regional Director</td>
  473. <td>London</td>
  474. <td>47</td>
  475. <td>2011/03/21</td>
  476. <td>$356,250</td>
  477. </tr>
  478. <tr>
  479. <td>Lael Greer</td>
  480. <td>Systems Administrator</td>
  481. <td>London</td>
  482. <td>21</td>
  483. <td>2009/02/27</td>
  484. <td>$103,500</td>
  485. </tr>
  486. <tr>
  487. <td>Jonas Alexander</td>
  488. <td>Developer</td>
  489. <td>San Francisco</td>
  490. <td>30</td>
  491. <td>2010/07/14</td>
  492. <td>$86,500</td>
  493. </tr>
  494. <tr>
  495. <td>Shad Decker</td>
  496. <td>Regional Director</td>
  497. <td>Edinburgh</td>
  498. <td>51</td>
  499. <td>2008/11/13</td>
  500. <td>$183,000</td>
  501. </tr>
  502. <tr>
  503. <td>Michael Bruce</td>
  504. <td>Javascript Developer</td>
  505. <td>Singapore</td>
  506. <td>29</td>
  507. <td>2011/06/27</td>
  508. <td>$183,000</td>
  509. </tr>
  510. <tr>
  511. <td>Donna Snider</td>
  512. <td>Customer Support</td>
  513. <td>New York</td>
  514. <td>27</td>
  515. <td>2011/01/25</td>
  516. <td>$112,000</td>
  517. </tr>
  518. </tbody>
  519. </table>
  520. <ul class="tabs">
  521. <li class="active">Javascript</li>
  522. <li>HTML</li>
  523. <li>CSS</li>
  524. <li>Ajax</li>
  525. <li>Server-side script</li>
  526. </ul>
  527. <div class="tabs">
  528. <div class="js">
  529. <p>The Javascript shown below is used to initialise the table shown in this example:</p><code class="multiline language-js">$(document).ready(function() {
  530. $('#example').DataTable( {
  531. dom: 'T&lt;&quot;clear&quot;&gt;lfrtip&lt;&quot;clear spacer&quot;&gt;T',
  532. tableTools: {
  533. &quot;aButtons&quot;: [ &quot;copy&quot;, &quot;print&quot; ]
  534. }
  535. } );
  536. } );</code>
  537. <p>In addition to the above code, the following Javascript library files are loaded for use in this example:</p>
  538. <ul>
  539. <li><a href="../../../media/js/jquery.js">../../../media/js/jquery.js</a></li>
  540. <li><a href="../../../media/js/jquery.dataTables.js">../../../media/js/jquery.dataTables.js</a></li>
  541. <li><a href="../js/dataTables.tableTools.js">../js/dataTables.tableTools.js</a></li>
  542. </ul>
  543. </div>
  544. <div class="table">
  545. <p>The HTML shown below is the raw HTML table element, before it has been enhanced by DataTables:</p>
  546. </div>
  547. <div class="css">
  548. <div>
  549. <p>This example uses a little bit of additional CSS beyond what is loaded from the library files (below), in order to correctly display the table. The
  550. additional CSS used is shown below:</p><code class="multiline language-css"></code>
  551. </div>
  552. <p>The following CSS library files are loaded for use in this example to provide the styling of the table:</p>
  553. <ul>
  554. <li><a href="../../../media/css/jquery.dataTables.css">../../../media/css/jquery.dataTables.css</a></li>
  555. <li><a href="../css/dataTables.tableTools.css">../css/dataTables.tableTools.css</a></li>
  556. </ul>
  557. </div>
  558. <div class="ajax">
  559. <p>This table loads data by Ajax. The latest data that has been loaded is shown below. This data will update automatically as any additional data is
  560. loaded.</p>
  561. </div>
  562. <div class="php">
  563. <p>The script used to perform the server-side processing for this table is shown below. Please note that this is just an example script using PHP. Server-side
  564. processing scripts can be written in any language, using <a href="//datatables.net/manual/server-side">the protocol described in the DataTables
  565. documentation</a>.</p>
  566. </div>
  567. </div>
  568. </section>
  569. </div>
  570. <section>
  571. <div class="footer">
  572. <div class="gradient"></div>
  573. <div class="liner">
  574. <h2>Other examples</h2>
  575. <div class="toc">
  576. <div class="toc-group">
  577. <h3><a href="./index.html">Examples</a></h3>
  578. <ul class="toc active">
  579. <li><a href="./simple.html">Basic initialisation</a></li>
  580. <li><a href="./swf_path.html">Setting the SWF path</a></li>
  581. <li><a href="./new_init.html">Initialisation with `new`</a></li>
  582. <li><a href="./defaults.html">Defaults</a></li>
  583. <li><a href="./select_single.html">Row selection - single row select</a></li>
  584. <li><a href="./select_multi.html">Row selection - multi-row select</a></li>
  585. <li><a href="./select_os.html">Row selection - operating system style</a></li>
  586. <li><a href="./select_column.html">Row selection - row selector on specific cells</a></li>
  587. <li><a href="./multiple_tables.html">Multiple tables</a></li>
  588. <li class="active"><a href="./multi_instance.html">Multiple toolbars</a></li>
  589. <li><a href="./collection.html">Button collections</a></li>
  590. <li><a href="./plug-in.html">Plug-in button types</a></li>
  591. <li><a href="./button_text.html">Custom button text</a></li>
  592. <li><a href="./alter_buttons.html">Button arrangement</a></li>
  593. <li><a href="./ajax.html">Ajax loaded data</a></li>
  594. <li><a href="./pdf_message.html">PDF message</a></li>
  595. <li><a href="./bootstrap.html">Bootstrap styling</a></li>
  596. <li><a href="./jqueryui.html">jQuery UI styling</a></li>
  597. </ul>
  598. </div>
  599. </div>
  600. <div class="epilogue">
  601. <p>Please refer to the <a href="http://www.datatables.net">DataTables documentation</a> for full information about its API properties and methods.<br>
  602. Additionally, there are a wide range of <a href="http://www.datatables.net/extras">extras</a> and <a href="http://www.datatables.net/plug-ins">plug-ins</a>
  603. which extend the capabilities of DataTables.</p>
  604. <p class="copyright">DataTables designed and created by <a href="http://www.sprymedia.co.uk">SpryMedia Ltd</a> &#169; 2007-2015<br>
  605. DataTables is licensed under the <a href="http://www.datatables.net/mit">MIT license</a>.</p>
  606. </div>
  607. </div>
  608. </div>
  609. </section>
  610. </body>
  611. </html>