Get started with datatables.net-rowgroup-bs5 CDN

MIT licensed

Datatables.net-rowgroup-bs5: plugin enables row grouping in DataTables with Bootstrap 5 styling.

Tags:
  • row grouping
  • DataTables
  • jQuery
  • table
  • Bootstrap 5

Stable version

Copied!

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


<!DOCTYPE html>
<html>
<head>
    <title>Get started with datatables.net-rowgroup-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;700&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/rowgroup/1.3.3/css/rowGroup.dataTables.min.css">
    <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/rowgroup/1.3.3/css/rowGroup.bootstrap5.min.css">
    <style>
        table.dataTable thead th,
        table.dataTable tbody td {
            vertical-align: middle;
        }
    </style>
</head>
<body>
    <div class="container mt-5">
        <table id="example" class="table table-bordered table-striped">
            <thead>
                <tr>
                    <th>Name</th>
                    <th>Age</th>
                    <th>City</th>
                    <th>Country</th>
                </tr>
            </thead>
            <tbody id="myTable">
                <tr data-group="group1">
                    <td>John Doe</td>
                    <td>30</td>
                    <td>New York</td>
                    <td>USA</td>
                </tr>
                <tr data-group="group1">
                    <td>Jane Doe</td>
                    <td>28</td>
                    <td>Los Angeles</td>
                    <td>USA</td>
                </tr>
                <tr data-group="group2">
                    <td>Alice Smith</td>
                    <td>35</td>
                    <td>London</td>
                    <td>UK</td>
                </tr>
                <tr data-group="group2">
                    <td>Bob Johnson</td>
                    <td>42</td>
                    <td>Paris</td>
                    <td>France</td>
                </tr>
            </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/rowgroup/1.3.3/js/dataTables.rowGroup.min.js"></script>
    <script src="https://cdn.datatables.net/rowgroup/1.3.3/js/dataTables.rowGroup.bootstrap5.min.js"></script>

    <script>
        $(document).ready(function() {
            $('#example').DataTable({
                rowGroup: {
                    dataSrc: ['data-group']
                },
                order: [[1, 'asc']]
            });
        });
    </script>
</body>
</html>
Copied!
Copied!
Copied!
Copied!

All versions