use jquery.floatThead rather than DataTables FixedHeader extension
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
[% IF opt %]
|
||||
<table id="data-table" class="table table-striped table-bordered table-fixed-header" width="100%" cellspacing="0">
|
||||
<table id="data-table" class="table table-striped table-bordered nd_floatinghead" width="100%" cellspacing="0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Device</th>
|
||||
@@ -16,7 +16,7 @@
|
||||
</thead>
|
||||
</table>
|
||||
[% ELSE %]
|
||||
<table id="data-table" class="table table-striped table-bordered table-fixed-header" width="100%" cellspacing="0">
|
||||
<table id="data-table" class="table table-striped table-bordered nd_floatinghead" width="100%" cellspacing="0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Class</th>
|
||||
@@ -31,13 +31,6 @@ function capitaliseFirstLetter(string) {
|
||||
return string.charAt(0).toUpperCase() + string.slice(1);
|
||||
}
|
||||
|
||||
function fhForceRedraw(fixedHeaders) {
|
||||
for (var i = 0; i < fixedHeaders.length; i++) {
|
||||
fixedHeaders[i]._fnUpdateClones(true); // force redraw
|
||||
fixedHeaders[i]._fnUpdatePositions();
|
||||
}
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
var table = $('#data-table').dataTable({
|
||||
"deferRender": true,
|
||||
@@ -100,30 +93,5 @@ $(document).ready(function() {
|
||||
]
|
||||
});
|
||||
|
||||
var fixedHeaders = [];
|
||||
$('.table-fixed-header').each(function() {
|
||||
fixedHeaders.push(
|
||||
new FixedHeader(this, {
|
||||
'offsetTop': 40 // offset for bootstrap navbar
|
||||
}));
|
||||
});
|
||||
|
||||
$(window).resize(function() {
|
||||
fhForceRedraw(fixedHeaders);
|
||||
});
|
||||
|
||||
$('.table-fixed-header').on('draw.dt', function() {
|
||||
fhForceRedraw(fixedHeaders);
|
||||
});
|
||||
|
||||
$('#nd_sidebar-toggle-img-out').click(function() {
|
||||
fhForceRedraw(fixedHeaders);
|
||||
});
|
||||
|
||||
$('#nd_sidebar-toggle-img-in').click(function() {
|
||||
fhForceRedraw(fixedHeaders);
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
</script>
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user