Sticky headers for bootstrap tables
This commit is contained in:
parent
7d64ab3158
commit
8d68bb7a57
4 changed files with 51 additions and 3 deletions
22
public/css/bootstrap-tables-sticky-header.css
vendored
Normal file
22
public/css/bootstrap-tables-sticky-header.css
vendored
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
/**
|
||||||
|
* @author vincent loh <vincent.ml@gmail.com>
|
||||||
|
* @version: v1.0.0
|
||||||
|
* https://github.com/vinzloh/bootstrap-table/
|
||||||
|
* Sticky header for bootstrap-table
|
||||||
|
*/
|
||||||
|
|
||||||
|
.fix-sticky {
|
||||||
|
position: fixed;
|
||||||
|
z-index: 100;
|
||||||
|
}
|
||||||
|
.fix-sticky thead {
|
||||||
|
background: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fix-sticky thead th,
|
||||||
|
.fix-sticky thead th:first-child {
|
||||||
|
border-left: 0;
|
||||||
|
border-right: 0;
|
||||||
|
border-bottom: 1px solid #eee;
|
||||||
|
border-radius: 0;
|
||||||
|
}
|
2
public/css/dist/all.css
vendored
2
public/css/dist/all.css
vendored
File diff suppressed because one or more lines are too long
|
@ -11,10 +11,28 @@
|
||||||
<script src="{{ asset('js/jspdf.plugin.autotable.js') }}"></script>
|
<script src="{{ asset('js/jspdf.plugin.autotable.js') }}"></script>
|
||||||
<script src="{{ asset('js/extensions/export/jquery.base64.js') }}"></script>
|
<script src="{{ asset('js/extensions/export/jquery.base64.js') }}"></script>
|
||||||
<script src="{{ asset('js/extensions/toolbar/bootstrap-table-toolbar.js') }}"></script>
|
<script src="{{ asset('js/extensions/toolbar/bootstrap-table-toolbar.js') }}"></script>
|
||||||
|
<script src="{{ asset('js/extensions/sticky-header/bootstrap-table-sticky-header.js') }}"></script>
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
<script nonce="{{ csrf_token() }}">
|
<script nonce="{{ csrf_token() }}">
|
||||||
$('.snipe-table').bootstrapTable({
|
|
||||||
|
var $table = $('.snipe-table');
|
||||||
|
$(function () {
|
||||||
|
buildTable($table, 20, 50);
|
||||||
|
});
|
||||||
|
function buildTable($el) {
|
||||||
|
var stickyHeaderOffsetY = 0;
|
||||||
|
|
||||||
|
if ( $('.navbar-fixed-top').css('height') ) {
|
||||||
|
stickyHeaderOffsetY = +$('.navbar-fixed-top').css('height').replace('px','');
|
||||||
|
}
|
||||||
|
if ( $('.navbar-fixed-top').css('margin-bottom') ) {
|
||||||
|
stickyHeaderOffsetY += +$('.navbar-fixed-top').css('margin-bottom').replace('px','');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$('.snipe-table').bootstrapTable('destroy').bootstrapTable({
|
||||||
classes: 'table table-responsive table-no-bordered',
|
classes: 'table table-responsive table-no-bordered',
|
||||||
undefinedText: '',
|
undefinedText: '',
|
||||||
iconsPrefix: 'fa',
|
iconsPrefix: 'fa',
|
||||||
|
@ -38,6 +56,11 @@ $('.snipe-table').bootstrapTable({
|
||||||
cookie: true,
|
cookie: true,
|
||||||
cookieExpire: '2y',
|
cookieExpire: '2y',
|
||||||
showExport: true,
|
showExport: true,
|
||||||
|
|
||||||
|
stickyHeader: true,
|
||||||
|
stickyHeaderOffsetY: stickyHeaderOffsetY + 'px',
|
||||||
|
|
||||||
|
|
||||||
@if (isset($showFooter))
|
@if (isset($showFooter))
|
||||||
showFooter: true,
|
showFooter: true,
|
||||||
@endif
|
@endif
|
||||||
|
@ -101,6 +124,8 @@ $('.snipe-table').bootstrapTable({
|
||||||
},
|
},
|
||||||
|
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function dateRowCheckStyle(value) {
|
function dateRowCheckStyle(value) {
|
||||||
|
|
|
@ -23,7 +23,8 @@ mix.styles([
|
||||||
'resources/assets/css/font-awesome/font-awesome.min.css',
|
'resources/assets/css/font-awesome/font-awesome.min.css',
|
||||||
'./bower_components/iCheck/skins/minimal/minimal.css',
|
'./bower_components/iCheck/skins/minimal/minimal.css',
|
||||||
'./node_modules/bootstrap-datepicker/dist/css/bootstrap-datepicker.standalone.css',
|
'./node_modules/bootstrap-datepicker/dist/css/bootstrap-datepicker.standalone.css',
|
||||||
'public/css/overrides.css',
|
'public/css/bootstrap-tables-sticky-header.css',
|
||||||
|
'public/css/overrides.css'
|
||||||
], 'public/css/dist/all.css');
|
], 'public/css/dist/all.css');
|
||||||
|
|
||||||
mix.js(
|
mix.js(
|
||||||
|
|
Loading…
Add table
Reference in a new issue