JSFiddle - React, Tailwind, and code Playground
HTML
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="https://cdn.datatables.net/1.10.16/css/jquery.dataTables.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src="https://cdn.datatables.net/1.10.16/js/jquery.dataTables.min.js"></script>
<script>
$(document).ready(function() {
var table=$('#example').DataTable({
"paging":false,fixedHeader:{header: true,footer: true},responsive: false,autoWidth: false, aaSorting: [[2, 'asc']], cache: true,
initComplete: function () {
}
});
$(".filterhead").each(function (i) {
if (i != 2) {
var select = $('<select><option value=""></option></select>')
.appendTo($(this).empty())
.on('change', function () {
var term = $(this).val();
table.column(i).search(term, false, false).draw();
});
table.column(i).data().unique().sort(function (a,b) {
var strA = a.toUpperCase(); // ignore upper and lowercase
var strB = b.toUpperCase(); // ignore upper and lowercase
if (strA < strB) {
return -1;
}
if (strA > strB) {
return 1;
}
return 0;
}).each(function (d, j) {
select.append('<option value="' + d + '">' + d + ' </option>')
});
} else {
$(this).empty();
}
});
} );
</script>
</head>
<body>
<table id="example" class="display" style="width:100%">
<thead>
<tr>
<th class="filterhead">Name</th>
<th class="filterhead">Position</th>
<th class="filterhead">Office</th>
<th class="filterhead">Age</th>
<th class="filterhead">Start date</th>
<th class="filterhead">Salary</th>
...