simple.html 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  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 - Basic initialisation</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. $('#example').DataTable( {
  22. ajax: "data/2500.txt",
  23. deferRender: true,
  24. dom: "frtiS",
  25. scrollY: 200,
  26. scrollCollapse: true
  27. } );
  28. } );
  29. </script>
  30. </head>
  31. <body class="dt-example">
  32. <div class="container">
  33. <section>
  34. <h1>Scroller example <span>Basic initialisation</span></h1>
  35. <div class="info">
  36. <p>Scroller is a plug-in for DataTables which enhances DataTables' built-in scrolling features to allow
  37. large amounts of data to be rendered on page very quickly. This is done by Scroller through the use of
  38. a virtual rendering technique that will render only the part of the table that is actually required for
  39. the current view.</p>
  40. <p>Note that Scroller assumes that all rows are of the same height (in order to preform the required
  41. calculations. You can use <code>td { white-space: nowrap; }</code> in your CSS to ensure that text in
  42. rows does not wrap.</p>
  43. <p>This example shows how Scroller for DataTables can be initialised by simply including the character
  44. <code>S</code> in sDom (note that the <code>S</code> must come after the <code>t</code> in sDom).
  45. Deferred rendering an and Ajax data source are also used in this example.</p>
  46. </div>
  47. <table id="example" class="display" cellspacing="0" width="100%">
  48. <thead>
  49. <tr>
  50. <th>ID</th>
  51. <th>First name</th>
  52. <th>Last name</th>
  53. <th>ZIP / Post code</th>
  54. <th>Country</th>
  55. </tr>
  56. </thead>
  57. </table>
  58. <ul class="tabs">
  59. <li class="active">Javascript</li>
  60. <li>HTML</li>
  61. <li>CSS</li>
  62. <li>Ajax</li>
  63. <li>Server-side script</li>
  64. </ul>
  65. <div class="tabs">
  66. <div class="js">
  67. <p>The Javascript shown below is used to initialise the table shown in this
  68. example:</p><code class="multiline brush: js;">$(document).ready(function() {
  69. $('#example').DataTable( {
  70. ajax: &quot;data/2500.txt&quot;,
  71. deferRender: true,
  72. dom: &quot;frtiS&quot;,
  73. scrollY: 200,
  74. scrollCollapse: true
  75. } );
  76. } );</code>
  77. <p>In addition to the above code, the following Javascript library files are loaded for use in this
  78. example:</p>
  79. <ul>
  80. <li><a href="../../../media/js/jquery.js">../../../media/js/jquery.js</a></li>
  81. <li><a href=
  82. "../../../media/js/jquery.dataTables.js">../../../media/js/jquery.dataTables.js</a></li>
  83. <li><a href="../js/dataTables.scroller.js">../js/dataTables.scroller.js</a></li>
  84. </ul>
  85. </div>
  86. <div class="table">
  87. <p>The HTML shown below is the raw HTML table element, before it has been enhanced by
  88. DataTables:</p>
  89. </div>
  90. <div class="css">
  91. <div>
  92. <p>This example uses a little bit of additional CSS beyond what is loaded from the library
  93. files (below), in order to correctly display the table. The additional CSS used is shown
  94. below:</p><code class="multiline brush: js;"></code>
  95. </div>
  96. <p>The following CSS library files are loaded for use in this example to provide the styling of the
  97. table:</p>
  98. <ul>
  99. <li><a href=
  100. "../../../media/css/jquery.dataTables.css">../../../media/css/jquery.dataTables.css</a></li>
  101. <li><a href="../css/dataTables.scroller.css">../css/dataTables.scroller.css</a></li>
  102. </ul>
  103. </div>
  104. <div class="ajax">
  105. <p>This table loads data by Ajax. The latest data that has been loaded is shown below. This data
  106. will update automatically as any additional data is loaded.</p>
  107. </div>
  108. <div class="php">
  109. <p>The script used to perform the server-side processing for this table is shown below. Please note
  110. that this is just an example script using PHP. Server-side processing scripts can be written in any
  111. language, using <a href="//datatables.net/manual/server-side">the protocol described in the
  112. DataTables documentation</a>.</p>
  113. </div>
  114. </div>
  115. </section>
  116. </div>
  117. <section>
  118. <div class="footer">
  119. <div class="gradient"></div>
  120. <div class="liner">
  121. <h2>Other examples</h2>
  122. <div class="toc">
  123. <div class="toc-group">
  124. <h3><a href="./index.html">Examples</a></h3>
  125. <ul class="toc active">
  126. <li class="active"><a href="./simple.html">Basic initialisation</a></li>
  127. <li><a href="./state_saving.html">State saving</a></li>
  128. <li><a href="./large_js_source.html">Client-side data source (50,000 rows)</a></li>
  129. <li><a href="./server-side_processing.html">Server-side processing (5,000,000
  130. rows)</a></li>
  131. <li><a href="./api_scrolling.html">API</a></li>
  132. </ul>
  133. </div>
  134. </div>
  135. <div class="epilogue">
  136. <p>Please refer to the <a href="http://www.datatables.net">DataTables documentation</a> for full
  137. information about its API properties and methods.<br>
  138. Additionally, there are a wide range of <a href="http://www.datatables.net/extras">extras</a> and
  139. <a href="http://www.datatables.net/plug-ins">plug-ins</a> which extend the capabilities of
  140. DataTables.</p>
  141. <p class="copyright">DataTables designed and created by <a href=
  142. "http://www.sprymedia.co.uk">SpryMedia Ltd</a> &#169; 2007-2014<br>
  143. DataTables is licensed under the <a href="http://www.datatables.net/mit">MIT license</a>.</p>
  144. </div>
  145. </div>
  146. </div>
  147. </section>
  148. </body>
  149. </html>