select_multi.html 17 KB

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