Released Installed
jQuery-optional table plugin with sorting, searching, pagination, and a large extension ecosystem. This build is styled for Bootstrap 5.
Included in this bundle: DataTables 3.1.1, AutoFill, Buttons, ColReorder, ColumnControl, DateTime, FixedColumns, FixedHeader, KeyTable, Responsive, RowGroup, RowReorder, Scroller, SearchBuilder, Select
Load Bootstrap 5 CSS first, then DataTables CSS. Scripts: Bootstrap (for Buttons dropdowns) → DataTables. jQuery is optional in DataTables 3; use the vanilla new DataTable() API below.
<!-- CSS in <head>: Bootstrap + DataTables -->
<link rel="stylesheet" href="https://cdn.roste.org/bootstrap/latest/bootstrap.min.css" />
<link rel="stylesheet" href="https://cdn.roste.org/datatables/latest/bs5/datatables.min.css" />
<!-- JS before </body>: Bootstrap → DataTables -->
<script src="https://cdn.roste.org/bootstrap/latest/bootstrap.bundle.min.js"></script>
<script src="https://cdn.roste.org/datatables/latest/bs5/datatables.min.js"></script>
<script>
new DataTable('#myTable');
</script><!-- CSS in <head>: Bootstrap + DataTables -->
<link rel="stylesheet" href="https://cdn.roste.org/bootstrap/latest/bootstrap.min.css" />
<link rel="stylesheet" href="https://cdn.roste.org/datatables/latest/bs5/datatables.min.css" />
<!-- JS before </body>: Bootstrap → DataTables -->
<script src="https://cdn.roste.org/bootstrap/latest/bootstrap.bundle.min.js"></script>
<script src="https://cdn.roste.org/datatables/latest/bs5/datatables.min.js"></script>
<script>
new DataTable('#myTable');
</script><!-- CSS in <head>: Bootstrap + DataTables -->
<link rel="stylesheet" href="../bootstrap/latest/bootstrap.min.css" />
<link rel="stylesheet" href="latest/bs5/datatables.min.css" />
<!-- JS before </body>: Bootstrap → DataTables -->
<script src="../bootstrap/latest/bootstrap.bundle.min.js"></script>
<script src="latest/bs5/datatables.min.js"></script>
<script>
new DataTable('#myTable');
</script> $('#myTable').DataTable())<script src="https://cdn.roste.org/jquery/latest/jquery.min.js"></script>
<script src="https://cdn.roste.org/bootstrap/latest/bootstrap.bundle.min.js"></script>
<script src="https://cdn.roste.org/datatables/latest/bs5/datatables.min.js"></script>
<script>$('#myTable').DataTable();</script><script src="https://cdn.roste.org/jquery/latest/jquery.min.js"></script>
<script src="https://cdn.roste.org/bootstrap/latest/bootstrap.bundle.min.js"></script>
<script src="https://cdn.roste.org/datatables/latest/bs5/datatables.min.js"></script>
<script>$('#myTable').DataTable();</script><script src="../jquery/latest/jquery.min.js"></script>
<script src="../bootstrap/latest/bootstrap.bundle.min.js"></script>
<script src="latest/bs5/datatables.min.js"></script>
<script>$('#myTable').DataTable();</script> Default sorting, search, and pagination from a plain HTML <table>.
| Name | Position | Office | Age | Start date | Salary |
|---|---|---|---|---|---|
| Tiger Nixon | System Architect | Edinburgh | 61 | 2011-04-25 | $320,800 |
| Garrett Winters | Accountant | Tokyo | 63 | 2011-07-25 | $170,750 |
| Ashton Cox | Junior Technical Author | San Francisco | 66 | 2009-01-12 | $86,000 |
| Cedric Kelly | Senior Javascript Developer | Edinburgh | 22 | 2012-03-29 | $433,060 |
| Airi Satou | Accountant | Tokyo | 33 | 2008-11-28 | $162,700 |
| Brielle Williamson | Integration Specialist | New York | 61 | 2012-12-02 | $372,000 |
| Herrod Chandler | Sales Assistant | San Francisco | 59 | 2012-08-06 | $137,500 |
| Rhona Davidson | Integration Specialist | Tokyo | 55 | 2010-10-14 | $327,900 |
| Colleen Hurst | Javascript Developer | San Francisco | 39 | 2009-09-15 | $205,500 |
| Sonya Frost | Software Engineer | Edinburgh | 23 | 2008-12-13 | $103,600 |
| Jena Gaines | Office Manager | London | 30 | 2008-12-19 | $90,560 |
| Quinn Flynn | Support Lead | Edinburgh | 22 | 2013-03-03 | $342,000 |
<table id="dt-basic" class="table table-striped" style="width:100%">
<thead>
<tr><th>Name</th><th>Position</th><th>Office</th><th>Age</th></tr>
</thead>
<tbody>
<tr><td>Tiger Nixon</td><td>System Architect</td><td>Edinburgh</td><td>61</td></tr>
<!-- more rows... -->
</tbody>
</table>
<script>
new DataTable('#dt-basic');
</script>Initialize from an array of objects with columns.data.
<table id="dt-js" class="table table-striped" style="width:100%"></table>
<script>
new DataTable('#dt-js', {
data: [
{ name: 'Tiger Nixon', position: 'System Architect', office: 'Edinburgh', salary: '$320,800' },
{ name: 'Garrett Winters', position: 'Accountant', office: 'Tokyo', salary: '$170,750' }
],
columns: [
{ data: 'name', title: 'Name' },
{ data: 'position', title: 'Position' },
{ data: 'office', title: 'Office' },
{ data: 'salary', title: 'Salary' }
]
});
</script>Shrink the viewport (or widen columns) — child rows appear for hidden data. Resize the window to try it.
| First name | Last name | Position | Office | Age | Start date | Salary | Extn. |
|---|---|---|---|---|---|---|---|
| Tiger | Nixon | System Architect | Edinburgh | 61 | 2011/04/25 | $320,800 | 5421 |
| Garrett | Winters | Accountant | Tokyo | 63 | 2011/07/25 | $170,750 | 8422 |
| Ashton | Cox | Junior Technical Author | San Francisco | 66 | 2009/01/12 | $86,000 | 1562 |
| Cedric | Kelly | Senior Javascript Developer | Edinburgh | 22 | 2012/03/29 | $433,060 | 6224 |
| Airi | Satou | Accountant | Tokyo | 33 | 2008/11/28 | $162,700 | 5407 |
<table id="dt-responsive" class="table table-striped nowrap" style="width:100%">...</table>
<script>
new DataTable('#dt-responsive', { responsive: true });
</script>Click rows to select (multi). Uses the Select extension.
| Name | Position | Office | Age |
|---|---|---|---|
| Tiger Nixon | System Architect | Edinburgh | 61 |
| Garrett Winters | Accountant | Tokyo | 63 |
| Ashton Cox | Junior Technical Author | San Francisco | 66 |
| Cedric Kelly | Senior Javascript Developer | Edinburgh | 22 |
| Airi Satou | Accountant | Tokyo | 33 |
<table id="dt-select" class="table table-striped" style="width:100%">...</table>
<script>
new DataTable('#dt-select', { select: true });
</script>Group rows by a column with the RowGroup extension.
| Name | Position | Office | Salary |
|---|---|---|---|
| Tiger Nixon | System Architect | Edinburgh | $320,800 |
| Cedric Kelly | Senior Javascript Developer | Edinburgh | $433,060 |
| Sonya Frost | Software Engineer | Edinburgh | $103,600 |
| Quinn Flynn | Support Lead | Edinburgh | $342,000 |
| Garrett Winters | Accountant | Tokyo | $170,750 |
| Airi Satou | Accountant | Tokyo | $162,700 |
| Rhona Davidson | Integration Specialist | Tokyo | $327,900 |
| Ashton Cox | Junior Technical Author | San Francisco | $86,000 |
| Herrod Chandler | Sales Assistant | San Francisco | $137,500 |
| Colleen Hurst | Javascript Developer | San Francisco | $205,500 |
<table id="dt-rowgroup" class="table table-striped" style="width:100%">...</table>
<script>
new DataTable('#dt-rowgroup', {
order: [[2, 'asc']],
rowGroup: { dataSrc: 2 }
});
</script>