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">
8 <title>Scroller example - Server-side processing (5,000,000 rows)</title>
9 <link rel="stylesheet" type="text/css" href="../../../media/css/jquery.dataTables.css">
10 <link rel="stylesheet" type="text/css" href="../css/dataTables.scroller.css">
11 <link rel="stylesheet" type="text/css" href="../../../examples/resources/syntax/shCore.css">
12 <link rel="stylesheet" type="text/css" href="../../../examples/resources/demo.css">
13 <style type="text/css" class="init">
16 <script type="text/javascript" language="javascript" src="../../../media/js/jquery.js"></script>
17 <script type="text/javascript" language="javascript" src="../../../media/js/jquery.dataTables.js"></script>
18 <script type="text/javascript" language="javascript" src="../js/dataTables.scroller.js"></script>
19 <script type="text/javascript" language="javascript" src="../../../examples/resources/syntax/shCore.js"></script>
20 <script type="text/javascript" language="javascript" src="../../../examples/resources/demo.js"></script>
21 <script type="text/javascript" language="javascript" class="init">
24 $(document).ready(function() {
25 $('#example').DataTable( {
29 ajax: function ( data, callback, settings ) {
32 for ( var i=data.start, ien=data.start+data.length ; i<ien ; i++ ) {
33 out.push( [ i+'-1', i+'-2', i+'-3', i+'-4', i+'-5' ] );
36 setTimeout( function () {
40 recordsTotal: 5000000,
41 recordsFiltered: 5000000
48 loadingIndicator: true
57 <body class="dt-example">
58 <div class="container">
60 <h1>Scroller example <span>Server-side processing (5,000,000 rows)</span></h1>
63 <p>DataTables' server-side processing mode is a feature that naturally fits in with Scroller perfectly.
64 Server-side processing can be used to show large data sets, with the server being used to do the data
65 processing, and Scroller optimising the display of the data in a scrolling viewport.</p>
67 <p>When using server-side processing, Scroller will wait a small amount of time to allow the scrolling
68 to finish before requesting more data from the server (200mS by default). This prevents you from DoSing
71 <p>This example shows Scroller using server-side processing mode and 5 million rows.
72 <strong>Important</strong> This particular example uses <a href=
73 "//datatables.net/reference/option/ajax"><code class="option" title=
74 "DataTables initialisation option">ajax<span>DT</span></code></a> as a function to 'fake' the data to
75 show Scroller's ability to show large data sets. It does not have a real database behind it! You would
76 normally not use <a href="//datatables.net/reference/option/ajax"><code class="option" title=
77 "DataTables initialisation option">ajax<span>DT</span></code></a> as a function to generate data, but
78 rather as a url for where to fetch the real data!</p>
80 <p>In this example we also enable the <code>loadingIndicator</code> option of Scroller to show the end
81 user what is happening when they scroll passed the currently loaded data.</p>
84 <table id="example" class="display" cellspacing="0" width="100%">
90 <th>ZIP / Post code</th>
97 <li class="active">Javascript</li>
101 <li>Server-side script</li>
106 <p>The Javascript shown below is used to initialise the table shown in this
107 example:</p><code class="multiline brush: js;">$(document).ready(function() {
108 $('#example').DataTable( {
112 ajax: function ( data, callback, settings ) {
115 for ( var i=data.start, ien=data.start+data.length ; i<ien ; i++ ) {
116 out.push( [ i+'-1', i+'-2', i+'-3', i+'-4', i+'-5' ] );
119 setTimeout( function () {
123 recordsTotal: 5000000,
124 recordsFiltered: 5000000
128 dom: "rtiS",
131 loadingIndicator: true
136 <p>In addition to the above code, the following Javascript library files are loaded for use in this
140 <li><a href="../../../media/js/jquery.js">../../../media/js/jquery.js</a></li>
142 "../../../media/js/jquery.dataTables.js">../../../media/js/jquery.dataTables.js</a></li>
143 <li><a href="../js/dataTables.scroller.js">../js/dataTables.scroller.js</a></li>
148 <p>The HTML shown below is the raw HTML table element, before it has been enhanced by
154 <p>This example uses a little bit of additional CSS beyond what is loaded from the library
155 files (below), in order to correctly display the table. The additional CSS used is shown
156 below:</p><code class="multiline brush: js;"></code>
159 <p>The following CSS library files are loaded for use in this example to provide the styling of the
164 "../../../media/css/jquery.dataTables.css">../../../media/css/jquery.dataTables.css</a></li>
165 <li><a href="../css/dataTables.scroller.css">../css/dataTables.scroller.css</a></li>
170 <p>This table loads data by Ajax. The latest data that has been loaded is shown below. This data
171 will update automatically as any additional data is loaded.</p>
175 <p>The script used to perform the server-side processing for this table is shown below. Please note
176 that this is just an example script using PHP. Server-side processing scripts can be written in any
177 language, using <a href="//datatables.net/manual/server-side">the protocol described in the
178 DataTables documentation</a>.</p>
186 <div class="gradient"></div>
189 <h2>Other examples</h2>
192 <div class="toc-group">
193 <h3><a href="./index.html">Examples</a></h3>
194 <ul class="toc active">
195 <li><a href="./simple.html">Basic initialisation</a></li>
196 <li><a href="./state_saving.html">State saving</a></li>
197 <li><a href="./large_js_source.html">Client-side data source (50,000 rows)</a></li>
198 <li class="active"><a href="./server-side_processing.html">Server-side processing
199 (5,000,000 rows)</a></li>
200 <li><a href="./api_scrolling.html">API</a></li>
205 <div class="epilogue">
206 <p>Please refer to the <a href="http://www.datatables.net">DataTables documentation</a> for full
207 information about its API properties and methods.<br>
208 Additionally, there are a wide range of <a href="http://www.datatables.net/extras">extras</a> and
209 <a href="http://www.datatables.net/plug-ins">plug-ins</a> which extend the capabilities of
212 <p class="copyright">DataTables designed and created by <a href=
213 "http://www.sprymedia.co.uk">SpryMedia Ltd</a> © 2007-2014<br>
214 DataTables is licensed under the <a href="http://www.datatables.net/mit">MIT license</a>.</p>