Get started with datatables.net-scroller-bs5 CDN

MIT licensed

Datatables.net-scroller-BS5: Bootstrap 5 scrolling plugin for DataTables.

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

Stable version

Copied!

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


<!DOCTYPE html>
<html>
<head>
    <title>Get started with datatables.net-scroller-bs5 CDN - cdnhub.io</title>
    <link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet">
    <link rel="preconnect" href="https://fonts.googleapis.com">
    <link rel="preconnect" href="https://fonts.gstatic.com">
    <link href="https://fonts.googleapis.com/css2?family=Open+Sans:wght@300;400;600&display=swap" rel="stylesheet">
    <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.bootstrap5.min.css">
</head>
<body>
    <div class="container mt-5">
        <table id="dataTableScroller" 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>
            <tbody id="dataTableScroller_wrapper">
            </tbody>
        </table>
    </div>

    <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/@popperjs/[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/1.11.5/js/jquery.dataTables.min.js"></script>
    <script src="https://cdn.datatables.net/scroller/2.4.1/js/dataTables.scroller.min.js"></script>
    <script src="https://cdn.datatables.net/scroller/2.4.1/js/dataTables.scroller.bootstrap5.min.js"></script>

    <script>
        $(document).ready(function() {
            $('#dataTableScroller').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: [[ 0, 'asc' ]],
                scroller: {
                    loadingIndicator: true,
                    height: 300,
                    scrollOnDataLoad: false,
                    preLoadSymbols: [ 'fa fa-spinner fa-spin' ],
                    postLoadSymbols: [ 'fa fa-check' ]
                }
            });
        });
    </script>
</body>
</html>
Copied!
Copied!
Copied!
Copied!

All versions