two_tables.html 9.5 KB

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