Get started with datatables.net-scroller-dt CDN

MIT licensed

Datatables.net Scroller-DT: plugin for infinite/virtual scrolling in DataTables.

Tags:
  • virtual scrolling
  • jQuery
  • table
  • DataTables

Stable version

Copied!

How to start using datatables.net-scroller-dt CDN


<!DOCTYPE html>
<html>
<head>
    <title>Get started with datatables.net-scroller-dt CDN - cdnhub.io</title>
    <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.11.5/css/jquery.dataTables.min.css">
    <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/scroller/2.4.1/css/scroller.dataTables.min.css">
    <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
    <script src="https://cdn.datatables.net/1.11.5/js/jquery.dataTables.min.js"></script>
    <script src="https://cdn.cdnhub.io/datatables.net-scroller-dt/2.4.1/scroller.dataTables.min.js"></script>
</head>
<body>
    <div style="width: 100%;">
        <table id="example" class="display nowrap" style="width: 100%">
            <thead>
                <tr>
                    <th>Name</th>
                    <th>Position</th>
                    <th>Office</th>
                    <th>Age</th>
                    <th>Start date</th>
                    <th>Salary</th>
                </tr>
            </thead>
        </table>
    </div>

    <script>
        $(document).ready(function() {
            $('#example').DataTable({
                processing: true,
                serverSide: true,
                ajax: 'https://jsonplaceholder.typicode.com/api/users',
                columns: [
                    { data: 'name' },
                    { data: 'position.title' },
                    { data: 'office.name' },
                    { data: 'age' },
                    { data: 'start_date' },
                    { data: 'salary' }
                ],
                order: [[ 1, 'asc' ]],
                scroller: true,
                lengthChange: false,
                pageLength: 10,
                deferRender: true,
                initComplete: function () {
                    this.api().columns.adjust().draw();
                }
            });
        });
    </script>
</body>
</html>
Copied!
Copied!
Copied!
Copied!

All versions