DataTables / DataTables/Dist-DataTables-Bootstrap5
Datatables 2.0 does not consider BS5 table variants
Nobody has claimed this yet.
- Dominant language
- CSS
- Stars
- 21
- Forks
- 1
- PR merge metrics
- No merged PRs in 30d
Description
I experimented a bit with Datatables 2.0 and various Bootstrap 5 Table variants (i.e. table header different color than table body). It seems that class dataTables which is inserted by datatables.js overrides most Bootstrap 5 classes (i.e. table-dark does have white text, but not black background).
Example:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
<link href="https://cdn.datatables.net/2.0.1/css/dataTables.bootstrap5.min.css" rel="stylesheet">
<script src="https://code.jquery.com/jquery-3.7.1.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
<script src="https://cdn.datatables.net/2.0.1/js/dataTables.min.js"></script>
<script src="https://cdn.datatables.net/2.0.1/js/dataTables.bootstrap5.min.js"></script>
</head>
<body>
<div class="container pt-3">
<h1>Datatables test</h1>
<div class="my-2">
<table id="sample-data" class="table table-striped table-success">
<thead class="table-dark">
<tr>
<th>Name</th>
<th>Position</th>
<th>Office</th>
<th>Age</th>
<th>Start date</th>
<th>Salary</th>
</tr>
</thead>
<tbody>
<tr>
<td>Tiger Nixon</td>
<td>System Architect</td>
<td>Edinburgh</td>
<td>61</td>
<td>2011-04-25</td>
<td>$320,800</td>
</tr>
<tr class="table-info">
<td>Garrett Winters</td>
<td>Accountant</td>
<td>Tokyo</td>
<td>63</td>
<td>2011-07-25</td>
<td>$170,750</td>
</tr>
<tr>
<td>Ashton Cox</td>
<td>Junior Technical Author</td>
<td>San Francisco</td>
<td>66</td>
<td>2009-01-12</td>
<td>$86,000</td>
</tr>
<tr>
<td>Cedric Kelly</td>
<td>Senior Javascript Developer</td>
<td>Edinburgh</td>
<td>22</td>
<td>2012-03-29</td>
<td>$433,060</td>
</tr>
<tr>
<td>Airi Satou</td>
<td>Accountant</td>
<td>Tokyo</td>
<td>33</td>
<td>2008-11-28</td>
<td>$162,700</td>
</tr>
</tbody>
</table>
</div>
</div>
<script>
$(document).ready(function() {
new DataTable('#sample-data', {});
});
</script>
</body>
</html>
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the provided Bootstrap 5.3.3 and DataTables 2.0.1 example, inspecting dataTables.bootstrap5.min.css alongside Bootstrap's table-variant styles. Verify the expected colors for table-dark, table-success, and table-info, and consider the issue resolved when DataTables no longer overrides those variants.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- bootstrap, css, javascript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100