Get started with datatables.net-rowgroup-dt CDN

MIT licensed

Datatables.net-rowgroup-dt is a plugin for DataTables that enables row grouping functionality.

Tags:
  • row grouping
  • jQuery
  • table
  • DataTables

Stable version

Copied!

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


<!DOCTYPE html>
<html>
<head>
    <title>Get started with datatables.net-rowgroup-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-rowgroup-dt/1.5.0/rowGroup.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-rowgroup-dt/1.5.0/rowGroup.dataTables.min.js"></script>
</head>
<body>
    <div style="width: 100%;">
        <table id="example" class="display" style="width: 100%">
            <thead>
                <tr>
                    <th>Name</th>
                    <th>Age</th>
                    <th>Group</th>
                </tr>
            </thead>
        </table>
    </div>

    <script>
        $(document).ready(function() {
            $('#example').DataTable({
                data: [
                    { name: 'Alice', age: 25, group: 'A' },
                    { name: 'Bob', age: 30, group: 'B' },
                    { name: 'Charlie', age: 35, group: 'A' },
                    { name: 'David', age: 40, group: 'B' },
                    { name: 'Eve', age: 45, group: 'A' },
                    { name: 'Frank', age: 50, group: 'B' }
                ],
                columns: [
                    { data: 'name' },
                    { data: 'age' },
                    { data: 'group' }
                ],
                order: [[1, 'asc']],
                rowGroup: {
                    dataSrc: 2,
                    className: ['group-a', 'group-b']
                }
            });
        });
    </script>
</body>
</html>
Copied!
Copied!
Copied!
Copied!

All versions