large_js_source.html 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
  2. <html>
  3. <head>
  4. <meta http-equiv="content-type" content="text/html; charset=utf-8" />
  5. <link rel="shortcut icon" type="image/ico" href="http://www.datatables.net/favicon.ico" />
  6. <title>DataTables example</title>
  7. <style type="text/css">
  8. @import "../../media/css/demo_page.css";
  9. @import "../../media/css/demo_table.css";
  10. @import "media/css/dataTables.scroller.css";
  11. </style>
  12. <script type="text/javascript" language="javascript" src="../../media/js/jquery.js"></script>
  13. <script type="text/javascript" language="javascript" src="../../media/js/jquery.dataTables.js"></script>
  14. <script type="text/javascript" language="javascript" src="media/js/dataTables.scroller.js"></script>
  15. <script type="text/javascript" charset="utf-8">
  16. $(document).ready(function() {
  17. var aaData = [];
  18. for ( var i=0 ; i<50000 ; i++ ) {
  19. aaData.push( [ i, i, i, i, i ] );
  20. }
  21. var oTable = $('#example').dataTable( {
  22. "sScrollY": "200px",
  23. "aaData": aaData,
  24. "sDom": "frtiS",
  25. "bDeferRender": true
  26. } );
  27. } );
  28. </script>
  29. </head>
  30. <body id="dt_example">
  31. <div id="container" style="width:980px">
  32. <div class="full_width big">
  33. Scroller example - 50'000 rows
  34. </div>
  35. <h1>Preamble</h1>
  36. <p>This example is completely artificial in that the data generated is created on the client-side by just looping around a Javascript array and then passing that to DataTables. However, it does show quite nicely that DataTables and Scroller can cope with large amounts of data on the client-side quite nicely. Typically data such as this would be Ajax sourced and server-side processing should be considered. Please be aware that the performance of this page will depend on your browser - for example IE6 will crawl!</p>
  37. <h1>Live example</h1>
  38. <div id="demo">
  39. <table cellpadding="0" cellspacing="0" border="0" class="display" id="example">
  40. <thead>
  41. <tr>
  42. <th>Column 1</th>
  43. <th>Column 2</th>
  44. <th>Column 3</th>
  45. <th>Column 4</th>
  46. <th>Column 5</th>
  47. </tr>
  48. </thead>
  49. </table>
  50. </div>
  51. <div class="spacer"></div>
  52. <h1>Initialisation code</h1>
  53. <pre>$(document).ready(function() {
  54. var aaData = [];
  55. for ( var i=1 ; i&lt;50000 ; i++ ) {
  56. aaData.push( [ i, i, i, i, i ] );
  57. }
  58. var oTable = $('#example').dataTable( {
  59. "sScrollY": "200px",
  60. "aaData": aaData,
  61. "sDom": "frtiS",
  62. "bDeferRender": true
  63. } );
  64. } );</pre>
  65. <h1>Other examples</h1>
  66. <div class="demo_links">
  67. <ul>
  68. <li><a href="index.html">Basic initialisation of Scroller</a></li>
  69. <li><a href="state_saving.html">State saving</a></li>
  70. <li><a href="api_scrolling.html">API - pragmatically move to a row</a></li>
  71. <li><a href="server-side_processing.html">Server-side processing with Scroller</a></li>
  72. <li><a href="large_js_source.html">50'000 rows in a table - client-side generated data</a></li>
  73. </ul>
  74. </div>
  75. </div>
  76. </body>
  77. </html>