api_scrolling.html 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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. $('#example').dataTable( {
  18. "sScrollY": "200px",
  19. "sAjaxSource": "media/data/2500.txt",
  20. "sDom": "frtiS",
  21. "bDeferRender": true,
  22. "fnInitComplete": function () {
  23. this.fnSettings().oScroller.fnScrollToRow( 1000 );
  24. }
  25. } );
  26. } );
  27. </script>
  28. </head>
  29. <body id="dt_example">
  30. <div id="container" style="width:980px">
  31. <div class="full_width big">
  32. Scroller API example
  33. </div>
  34. <h1>Preamble</h1>
  35. <p>This example shows a trivial use of the Scroller API to scroll the table to row 1000 once the table has been loaded. Any number could be used here, and a small animated effect is used to provide visual feedback to the user (this can be disabled by passed false as a second parameter to fnScrollToRow).</p>
  36. <h1>Live example</h1>
  37. <div id="demo">
  38. <table cellpadding="0" cellspacing="0" border="0" class="display" id="example">
  39. <thead>
  40. <tr>
  41. <th>ID</th>
  42. <th>First name</th>
  43. <th>Last name</th>
  44. <th>ZIP</th>
  45. <th width="33%">Country</th>
  46. </tr>
  47. </thead>
  48. </table>
  49. </div>
  50. <div class="spacer"></div>
  51. <h1>Initialisation code</h1>
  52. <pre>$(document).ready(function() {
  53. $('#example').dataTable( {
  54. "sScrollY": "200px",
  55. "sAjaxSource": "media/data/2500.txt",
  56. "sDom": "frtiS",
  57. "bDeferRender": true,
  58. "fnInitComplete": function () {
  59. this.fnSettings().oScroller.fnScrollToRow( 1000 );
  60. }
  61. } );
  62. } );</pre>
  63. <h1>Other examples</h1>
  64. <div class="demo_links">
  65. <ul>
  66. <li><a href="index.html">Basic initialisation of Scroller</a></li>
  67. <li><a href="state_saving.html">State saving</a></li>
  68. <li><a href="api_scrolling.html">API - pragmatically move to a row</a></li>
  69. <li><a href="server-side_processing.html">Server-side processing with Scroller</a></li>
  70. <li><a href="large_js_source.html">50'000 rows in a table - client-side generated data</a></li>
  71. </ul>
  72. </div>
  73. </div>
  74. </body>
  75. </html>