Get started with datatables.net-scroller-bs4 CDN

MIT licensed

Datatables.net-scroller-bs4: Bootstrap 4 scrolling plugin for DataTables.

Tags:
  • virtual scrolling
  • DataTables
  • jQuery
  • table
  • Bootstrap 4

Stable version

Copied!

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


<!DOCTYPE html>
<html>
<head>
    <title>Get started with datatables.net-scroller-bs4 CDN - cdnhub.io</title>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css">
    <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/scroller/bs4/2.4.1/css/scroller.bootstrap4.min.css">
</head>
<body>
    <div class="container mt-5">
        <table id="dataTable" class="table table-bordered table-striped">
            <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 src="https://code.jquery.com/jquery-3.5.1.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/umd/popper.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.min.js"></script>
    <script src="https://cdn.datatables.net/scroller/bs4/2.4.1/js/dataTables.scroller.min.js"></script>
    <script src="https://cdn.datatables.net/scroller/bs4/2.4.1/js/dataTables.scroller.bootstrap4.min.js"></script>

    <script>
        $(document).ready(function() {
            $('#dataTable').DataTable({
                ajax: 'https://jsonplaceholder.typicode.com/users',
                columns: [
                    { data: 'name' },
                    { data: 'position.title' },
                    { data: 'office.city' },
                    { data: 'age' },
                    { data: 'created_at' },
                    { data: 'salary' }
                ],
                scroller: true,
                deferRender: true,
                processing: true,
                serverSide: false,
                order: [[ 0, 'asc' ]],
                lengthMenu: [10, 25, 50, 100],
                pageLength: 10
            });
        });
    </script>
</body>
</html>
Copied!
Copied!
Copied!
Copied!

All versions