two_tables.html 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339
  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>ColVis example - Two tables with individual controls</title>
  8. <link rel="stylesheet" type="text/css" href="../../../media/css/jquery.dataTables.css">
  9. <link rel="stylesheet" type="text/css" href="../css/dataTables.colVis.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.colVis.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. $('table.display').DataTable( {
  22. dom: 'C<"clear">lfrtip',
  23. displayLength: 5
  24. } );
  25. } );
  26. </script>
  27. </head>
  28. <body class="dt-example">
  29. <div class="container">
  30. <section>
  31. <h1>ColVis example <span>Two tables with individual controls</span></h1>
  32. <div class="info">
  33. <p>It can be useful to have DataTables initialise more than one table with a single call can for them to each have individual ColVis controllers. All this requires
  34. is a suitable jQuery selector to be used, and DataTables and ColVis will take care of the rest - as shown in this example.</p>
  35. </div>
  36. <table id="" class="display" cellspacing="0" width="100%">
  37. <thead>
  38. <tr>
  39. <th>Name</th>
  40. <th>Position</th>
  41. <th>Office</th>
  42. <th>Age</th>
  43. <th>Salary</th>
  44. </tr>
  45. </thead>
  46. <tfoot>
  47. <tr>
  48. <th>Name</th>
  49. <th>Position</th>
  50. <th>Office</th>
  51. <th>Age</th>
  52. <th>Salary</th>
  53. </tr>
  54. </tfoot>
  55. <tbody>
  56. <tr>
  57. <td>Tiger Nixon</td>
  58. <td>System Architect</td>
  59. <td>Edinburgh</td>
  60. <td>61</td>
  61. <td>$320,800</td>
  62. </tr>
  63. <tr>
  64. <td>Cedric Kelly</td>
  65. <td>Senior Javascript Developer</td>
  66. <td>Edinburgh</td>
  67. <td>22</td>
  68. <td>$433,060</td>
  69. </tr>
  70. <tr>
  71. <td>Sonya Frost</td>
  72. <td>Software Engineer</td>
  73. <td>Edinburgh</td>
  74. <td>23</td>
  75. <td>$103,600</td>
  76. </tr>
  77. <tr>
  78. <td>Quinn Flynn</td>
  79. <td>Support Lead</td>
  80. <td>Edinburgh</td>
  81. <td>22</td>
  82. <td>$342,000</td>
  83. </tr>
  84. <tr>
  85. <td>Dai Rios</td>
  86. <td>Personnel Lead</td>
  87. <td>Edinburgh</td>
  88. <td>35</td>
  89. <td>$217,500</td>
  90. </tr>
  91. <tr>
  92. <td>Gavin Joyce</td>
  93. <td>Developer</td>
  94. <td>Edinburgh</td>
  95. <td>42</td>
  96. <td>$92,575</td>
  97. </tr>
  98. <tr>
  99. <td>Martena Mccray</td>
  100. <td>Post-Sales support</td>
  101. <td>Edinburgh</td>
  102. <td>46</td>
  103. <td>$324,050</td>
  104. </tr>
  105. <tr>
  106. <td>Jennifer Acosta</td>
  107. <td>Junior Javascript Developer</td>
  108. <td>Edinburgh</td>
  109. <td>43</td>
  110. <td>$75,650</td>
  111. </tr>
  112. <tr>
  113. <td>Shad Decker</td>
  114. <td>Regional Director</td>
  115. <td>Edinburgh</td>
  116. <td>51</td>
  117. <td>$183,000</td>
  118. </tr>
  119. </tbody>
  120. </table>
  121. <table id="" class="display" cellspacing="0" width="100%">
  122. <thead>
  123. <tr>
  124. <th>Name</th>
  125. <th>Position</th>
  126. <th>Office</th>
  127. <th>Age</th>
  128. <th>Salary</th>
  129. </tr>
  130. </thead>
  131. <tfoot>
  132. <tr>
  133. <th>Name</th>
  134. <th>Position</th>
  135. <th>Office</th>
  136. <th>Age</th>
  137. <th>Salary</th>
  138. </tr>
  139. </tfoot>
  140. <tbody>
  141. <tr>
  142. <td>Jena Gaines</td>
  143. <td>Office Manager</td>
  144. <td>London</td>
  145. <td>30</td>
  146. <td>$90,560</td>
  147. </tr>
  148. <tr>
  149. <td>Haley Kennedy</td>
  150. <td>Senior Marketing Designer</td>
  151. <td>London</td>
  152. <td>43</td>
  153. <td>$313,500</td>
  154. </tr>
  155. <tr>
  156. <td>Tatyana Fitzpatrick</td>
  157. <td>Regional Director</td>
  158. <td>London</td>
  159. <td>19</td>
  160. <td>$385,750</td>
  161. </tr>
  162. <tr>
  163. <td>Michael Silva</td>
  164. <td>Marketing Designer</td>
  165. <td>London</td>
  166. <td>66</td>
  167. <td>$198,500</td>
  168. </tr>
  169. <tr>
  170. <td>Bradley Greer</td>
  171. <td>Software Engineer</td>
  172. <td>London</td>
  173. <td>41</td>
  174. <td>$132,000</td>
  175. </tr>
  176. <tr>
  177. <td>Angelica Ramos</td>
  178. <td>Chief Executive Officer (CEO)</td>
  179. <td>London</td>
  180. <td>47</td>
  181. <td>$1,200,000</td>
  182. </tr>
  183. <tr>
  184. <td>Suki Burks</td>
  185. <td>Developer</td>
  186. <td>London</td>
  187. <td>53</td>
  188. <td>$114,500</td>
  189. </tr>
  190. <tr>
  191. <td>Prescott Bartlett</td>
  192. <td>Technical Author</td>
  193. <td>London</td>
  194. <td>27</td>
  195. <td>$145,000</td>
  196. </tr>
  197. <tr>
  198. <td>Timothy Mooney</td>
  199. <td>Office Manager</td>
  200. <td>London</td>
  201. <td>37</td>
  202. <td>$136,200</td>
  203. </tr>
  204. <tr>
  205. <td>Bruno Nash</td>
  206. <td>Software Engineer</td>
  207. <td>London</td>
  208. <td>38</td>
  209. <td>$163,500</td>
  210. </tr>
  211. <tr>
  212. <td>Hermione Butler</td>
  213. <td>Regional Director</td>
  214. <td>London</td>
  215. <td>47</td>
  216. <td>$356,250</td>
  217. </tr>
  218. <tr>
  219. <td>Lael Greer</td>
  220. <td>Systems Administrator</td>
  221. <td>London</td>
  222. <td>21</td>
  223. <td>$103,500</td>
  224. </tr>
  225. </tbody>
  226. </table>
  227. <ul class="tabs">
  228. <li class="active">Javascript</li>
  229. <li>HTML</li>
  230. <li>CSS</li>
  231. <li>Ajax</li>
  232. <li>Server-side script</li>
  233. </ul>
  234. <div class="tabs">
  235. <div class="js">
  236. <p>The Javascript shown below is used to initialise the table shown in this example:</p><code class="multiline language-js">$(document).ready(function() {
  237. $('table.display').DataTable( {
  238. dom: 'C&lt;&quot;clear&quot;&gt;lfrtip',
  239. displayLength: 5
  240. } );
  241. } );</code>
  242. <p>In addition to the above code, the following Javascript library files are loaded for use in this example:</p>
  243. <ul>
  244. <li><a href="../../../media/js/jquery.js">../../../media/js/jquery.js</a></li>
  245. <li><a href="../../../media/js/jquery.dataTables.js">../../../media/js/jquery.dataTables.js</a></li>
  246. <li><a href="../js/dataTables.colVis.js">../js/dataTables.colVis.js</a></li>
  247. </ul>
  248. </div>
  249. <div class="table">
  250. <p>The HTML shown below is the raw HTML table element, before it has been enhanced by DataTables:</p>
  251. </div>
  252. <div class="css">
  253. <div>
  254. <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
  255. additional CSS used is shown below:</p><code class="multiline language-css"></code>
  256. </div>
  257. <p>The following CSS library files are loaded for use in this example to provide the styling of the table:</p>
  258. <ul>
  259. <li><a href="../../../media/css/jquery.dataTables.css">../../../media/css/jquery.dataTables.css</a></li>
  260. <li><a href="../css/dataTables.colVis.css">../css/dataTables.colVis.css</a></li>
  261. </ul>
  262. </div>
  263. <div class="ajax">
  264. <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
  265. loaded.</p>
  266. </div>
  267. <div class="php">
  268. <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
  269. processing scripts can be written in any language, using <a href="//datatables.net/manual/server-side">the protocol described in the DataTables
  270. documentation</a>.</p>
  271. </div>
  272. </div>
  273. </section>
  274. </div>
  275. <section>
  276. <div class="footer">
  277. <div class="gradient"></div>
  278. <div class="liner">
  279. <h2>Other examples</h2>
  280. <div class="toc">
  281. <div class="toc-group">
  282. <h3><a href="./index.html">Examples</a></h3>
  283. <ul class="toc active">
  284. <li><a href="./simple.html">Basic initialisation</a></li>
  285. <li><a href="./new_init.html">`new` initialisation</a></li>
  286. <li><a href="./text.html">Custom button text</a></li>
  287. <li><a href="./exclude_columns.html">Exclude columns from list</a></li>
  288. <li><a href="./title_callback.html">Column button callback</a></li>
  289. <li><a href="./button_order.html">Button ordering</a></li>
  290. <li><a href="./mouseover.html">Mouseover activation</a></li>
  291. <li><a href="./group_columns.html">Group columns</a></li>
  292. <li class="active"><a href="./two_tables.html">Two tables with individual controls</a></li>
  293. <li><a href="./two_tables_identical.html">Two tables with shared controls</a></li>
  294. <li><a href="./restore.html">Restore / show all</a></li>
  295. <li><a href="./jqueryui.html">jQuery UI styling</a></li>
  296. </ul>
  297. </div>
  298. </div>
  299. <div class="epilogue">
  300. <p>Please refer to the <a href="http://www.datatables.net">DataTables documentation</a> for full information about its API properties and methods.<br>
  301. 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>
  302. which extend the capabilities of DataTables.</p>
  303. <p class="copyright">DataTables designed and created by <a href="http://www.sprymedia.co.uk">SpryMedia Ltd</a> &#169; 2007-2015<br>
  304. DataTables is licensed under the <a href="http://www.datatables.net/mit">MIT license</a>.</p>
  305. </div>
  306. </div>
  307. </div>
  308. </section>
  309. </body>
  310. </html>