44 |
Scroller is a plug-in for DataTables which enhances DataTables' built-in scrolling features to allow
45 | large amounts of data to be rendered on page very quickly. This is done by Scroller through the use of
46 | a virtual rendering technique that will render only the part of the table that is actually required for
47 | the current view.
48 |
49 |
Note that Scroller assumes that all rows are of the same height (in order to preform the required
50 | calculations. You can use td { white-space: nowrap; }
in your CSS to ensure that text in
51 | rows does not wrap.
52 |
53 |
This example shows how Scroller for DataTables can be initialised by simply including the character
54 | S
in sDom (note that the S
must come after the t
in sDom).
55 | Deferred rendering an and Ajax data source are also used in this example.
56 |
57 |
58 |
79 |
80 |
The Javascript shown below is used to initialise the table shown in this
81 | example:
$(document).ready(function() {
82 | $('#example').DataTable( {
83 | ajax: "data/2500.txt",
84 | deferRender: true,
85 | dom: "frtiS",
86 | scrollY: 200,
87 | scrollCollapse: true
88 | } );
89 | } );
90 |
91 |
In addition to the above code, the following Javascript library files are loaded for use in this
92 | example:
93 |
94 |
100 |
101 |
102 |
103 |
The HTML shown below is the raw HTML table element, before it has been enhanced by
104 | DataTables:
105 |
106 |
107 |
108 |
109 |
This example uses a little bit of additional CSS beyond what is loaded from the library
110 | files (below), in order to correctly display the table. The additional CSS used is shown
111 | below:
112 |
113 |
114 |
The following CSS library files are loaded for use in this example to provide the styling of the
115 | table:
116 |
117 |
122 |
123 |
124 |
125 |
This table loads data by Ajax. The latest data that has been loaded is shown below. This data
126 | will update automatically as any additional data is loaded.
127 |
128 |
129 |
135 |
136 |