This time I will share jQuery Plugin and tutorial about Performant Virtual Table Plugin For jQuery – lazyTable, hope it will help you in programming stack.
lazytable is a dynamic, high-performance jQuery virtual table plugin which allows you to display a huge amount of rows in your scrollable HTML table, while delaying the loading of table rows until they are visible in the viewport.
How to use it:
1. Insert an empty HTML table into a container element.
1 |
< div class = "tableWrapper" > |
2. The container must have a fixed height to make the HTML table scrollable.
3. Insert jQuery library and the minified version of the jQuery lazytable plugin into the page.
2 |
integrity = "sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" |
3 |
crossorigin = "anonymous" > |
5 |
< script src = "jquery.lazytable.min.js" ></ script > |
4. Define your tabular data to be presented in the table.
2 |
[ 'a1' , 'a2' , 'a3' , 'a4' ], |
3 |
[ 'b1' , 'b2' , 'b3' , 'b4' ], |
4 |
[ 'c1' , 'c2' , 'c3' , 'c4' ], |
5. The JavaScript to render the data into your table.
1 |
$( '.tableWrapper' ).LazyTable({ |
6. Possible options to customize the lazytable plugin.
01 |
$( '.tableWrapper' ).LazyTable({ |
11 |
generator: function (row) { return '<tr><td>' + row.join( '</td><td>' ) + '</td></tr>' ; }, |
26 |
appendFn: function (rows) { |
27 |
tableBody.append(rows.join()); |
28 |
return $.Deferred().resolve().promise(); |
30 |
prependFn: function (rows) { |
31 |
tableBody.prepend(rows.join()); |
32 |
return $.Deferred().resolve().promise(); |
34 |
deleteFn: function (startIndex, endIndex) { |
35 |
tableBody.children().slice(startIndex, endIndex).remove(); |
36 |
return $.Deferred().resolve().promise(); |
7. Available Callback functions.
1 |
$( '.tableWrapper' ).LazyTable({ |
Changelog:
2021-01-14
2018-08-23
2018-04-05
2018-03-29