large_js_source.html 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  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>Scroller example - Client-side data source (50,000 rows)</title>
  8. <link rel="stylesheet" type="text/css" href="../../../media/css/jquery.dataTables.css">
  9. <link rel="stylesheet" type="text/css" href="../css/dataTables.scroller.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.scroller.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 data = [];
  22. for ( var i=0 ; i<50000 ; i++ ) {
  23. data.push( [ i, i, i, i, i ] );
  24. }
  25. var oTable = $('#example').dataTable( {
  26. data: data,
  27. deferRender: true,
  28. dom: "frtiS",
  29. scrollY: 200,
  30. scrollCollapse: true
  31. } );
  32. } );
  33. </script>
  34. </head>
  35. <body class="dt-example">
  36. <div class="container">
  37. <section>
  38. <h1>Scroller example <span>Client-side data source (50,000 rows)</span></h1>
  39. <div class="info">
  40. <p>This example is completely artificial in that the data generated is created on the client-side by
  41. just looping around a Javascript array and then passing that to DataTables. However, it does show quite
  42. nicely that DataTables and Scroller can cope with large amounts of data on the client-side quite
  43. nicely. Typically data such as this would be Ajax sourced and server-side processing should be
  44. considered.</p>
  45. <p>Please be aware that the performance of this page will depend on your browser as the array of data
  46. is generated - for example IE6 will crawl!</p>
  47. </div>
  48. <table id="example" class="display" cellspacing="0" width="100%">
  49. <thead>
  50. <tr>
  51. <th>ID</th>
  52. <th>First name</th>
  53. <th>Last name</th>
  54. <th>ZIP / Post code</th>
  55. <th>Country</th>
  56. </tr>
  57. </thead>
  58. </table>
  59. <ul class="tabs">
  60. <li class="active">Javascript</li>
  61. <li>HTML</li>
  62. <li>CSS</li>
  63. <li>Ajax</li>
  64. <li>Server-side script</li>
  65. </ul>
  66. <div class="tabs">
  67. <div class="js">
  68. <p>The Javascript shown below is used to initialise the table shown in this
  69. example:</p><code class="multiline brush: js;">$(document).ready(function() {
  70. var data = [];
  71. for ( var i=0 ; i&lt;50000 ; i++ ) {
  72. data.push( [ i, i, i, i, i ] );
  73. }
  74. var oTable = $('#example').dataTable( {
  75. data: data,
  76. deferRender: true,
  77. dom: &quot;frtiS&quot;,
  78. scrollY: 200,
  79. scrollCollapse: true
  80. } );
  81. } );</code>
  82. <p>In addition to the above code, the following Javascript library files are loaded for use in this
  83. example:</p>
  84. <ul>
  85. <li><a href="../../../media/js/jquery.js">../../../media/js/jquery.js</a></li>
  86. <li><a href=
  87. "../../../media/js/jquery.dataTables.js">../../../media/js/jquery.dataTables.js</a></li>
  88. <li><a href="../js/dataTables.scroller.js">../js/dataTables.scroller.js</a></li>
  89. </ul>
  90. </div>
  91. <div class="table">
  92. <p>The HTML shown below is the raw HTML table element, before it has been enhanced by
  93. DataTables:</p>
  94. </div>
  95. <div class="css">
  96. <div>
  97. <p>This example uses a little bit of additional CSS beyond what is loaded from the library
  98. files (below), in order to correctly display the table. The additional CSS used is shown
  99. below:</p><code class="multiline brush: js;"></code>
  100. </div>
  101. <p>The following CSS library files are loaded for use in this example to provide the styling of the
  102. table:</p>
  103. <ul>
  104. <li><a href=
  105. "../../../media/css/jquery.dataTables.css">../../../media/css/jquery.dataTables.css</a></li>
  106. <li><a href="../css/dataTables.scroller.css">../css/dataTables.scroller.css</a></li>
  107. </ul>
  108. </div>
  109. <div class="ajax">
  110. <p>This table loads data by Ajax. The latest data that has been loaded is shown below. This data
  111. will update automatically as any additional data is loaded.</p>
  112. </div>
  113. <div class="php">
  114. <p>The script used to perform the server-side processing for this table is shown below. Please note
  115. that this is just an example script using PHP. Server-side processing scripts can be written in any
  116. language, using <a href="//datatables.net/manual/server-side">the protocol described in the
  117. DataTables documentation</a>.</p>
  118. </div>
  119. </div>
  120. </section>
  121. </div>
  122. <section>
  123. <div class="footer">
  124. <div class="gradient"></div>
  125. <div class="liner">
  126. <h2>Other examples</h2>
  127. <div class="toc">
  128. <div class="toc-group">
  129. <h3><a href="./index.html">Examples</a></h3>
  130. <ul class="toc active">
  131. <li><a href="./simple.html">Basic initialisation</a></li>
  132. <li><a href="./state_saving.html">State saving</a></li>
  133. <li class="active"><a href="./large_js_source.html">Client-side data source (50,000
  134. rows)</a></li>
  135. <li><a href="./server-side_processing.html">Server-side processing (5,000,000
  136. rows)</a></li>
  137. <li><a href="./api_scrolling.html">API</a></li>
  138. </ul>
  139. </div>
  140. </div>
  141. <div class="epilogue">
  142. <p>Please refer to the <a href="http://www.datatables.net">DataTables documentation</a> for full
  143. information about its API properties and methods.<br>
  144. Additionally, there are a wide range of <a href="http://www.datatables.net/extras">extras</a> and
  145. <a href="http://www.datatables.net/plug-ins">plug-ins</a> which extend the capabilities of
  146. DataTables.</p>
  147. <p class="copyright">DataTables designed and created by <a href=
  148. "http://www.sprymedia.co.uk">SpryMedia Ltd</a> &#169; 2007-2014<br>
  149. DataTables is licensed under the <a href="http://www.datatables.net/mit">MIT license</a>.</p>
  150. </div>
  151. </div>
  152. </div>
  153. </section>
  154. </body>
  155. </html>