Hi @BeUnique,
You can use jQuery DataTable plugin to fix the header.
Demo:
<script type="text/javascript" src="https://code.jquery.com/jquery-3.5.1.js"></script>
<script type="text/javascript" src="https://cdn.datatables.net/1.12.1/js/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="https://cdn.datatables.net/fixedcolumns/4.1.0/js/dataTables.fixedColumns.min.js"></script>
<link href="https://cdn.datatables.net/1.12.1/css/jquery.dataTables.min.css" rel="stylesheet" type="text/css" />
<link href="https://cdn.datatables.net/fixedcolumns/4.1.0/css/fixedColumns.dataTables.min.css" rel="stylesheet" type="text/css" />
<style type="text/css">
.auto-style1 { width: 600px; border-style: solid; border-width: 2px; }
.dataTables_scrollHead { width: 600px !important; }
.dataTables_scrollHeadInner { width: 600px !important; }
.dataTables_scrollBody { width: 600px !important; }
</style>
<script type="text/javascript">
$(function () {
$('#gvCustomers tfoot tr').appendTo('#gvCustomers thead');
$('#gvCustomers').removeAttr('width').DataTable({
bFilter: true,
bSort: true,
scrollY: "150px",
scrollCollapse: true,
paging: false,
fixedColumns: false,
orderCellsTop: true
});
});
</script>
Or use Responsive used with the DataTables FixedHeader extension.
https://datatables.net/extensions/responsive/examples/column-control/fixedHeader.html
Best regards,
Lan Huang
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread