HTML table with sorting, filtering, and a sticky header
<script src="https://cdn.jsdelivr.net/gh/rystaf/mvt/mvt.js"></script>
or you can copy the source!
MVT(document.querySelector('table'))
sorting dates requires values to be contained in a time
element with valid datetime attribute
th[data-sort="-1"]::after {
content: " ▲";
}
th[data-sort="1"]::after {
content: " ▼";
}
Place an input
in the th
of the column you want to filter
<th>
<input type="text">
Name
</th>
thead {
position: sticky;
top: 0;
background-color: #ddd;
}