I'm trying to get custom looking horizontal scrollbar for jQuery Datatables. Using some information I found so far, I came up with something like this:
$('#table').dataTable({
"bFilter": false,
"bLengthChange": false,
"bInfo": false,
"sPaginationType": "two_button",
"iDisplayLength": 6,
"sScrollX": "100%",
"sScrollXInner": "110%",
"bScrollCollapse": true,
"fnInitComplete": function() {
var table_header,
_this = this;
table_header = $('.dataTables_scrollHeadInner').css('position',
'relative');
$('body').find('.dataTables_scrollBody').bind('jsp-scroll-x',
function(event, scrollPositionX, isAtLeft, isAtRight) {
table_header.css('right', scrollPositionX);
}).jScrollPane({
verticalDragMinHeight: 8,
verticalDragMaxHeight: 8,
horizontalDragMinWidth: 82,
horizontalDragMaxWidth: 82,
autoReinitialise: true
});
});
It works fine: however, when I resize the window the table header doesn't scale down the same way that the content does (header is wider than content). Is there any way to attach jScrollPane to jQuery Datatables to scroll header and body equally? I mean something like:
$('#blabla').find('.dataTables_scrollBody').jScrollPane();
but for scrollBody AND scrollHead. Or is there any way for initializing scrollable Datatable without division to separate header and body?
Thanks!
$('#table').dataTable({
"bFilter": false,
"bLengthChange": false,
"bInfo": false,
"sPaginationType": "two_button",
"iDisplayLength": 6,
"sScrollX": "100%",
"sScrollXInner": "110%",
"bScrollCollapse": true,
"fnInitComplete": function() {
var table_header,
_this = this;
table_header = $('.dataTables_scrollHeadInner').css('position',
'relative');
$('body').find('.dataTables_scrollBody').bind('jsp-scroll-x',
function(event, scrollPositionX, isAtLeft, isAtRight) {
table_header.css('right', scrollPositionX);
}).jScrollPane({
verticalDragMinHeight: 8,
verticalDragMaxHeight: 8,
horizontalDragMinWidth: 82,
horizontalDragMaxWidth: 82,
autoReinitialise: true
});
});
It works fine: however, when I resize the window the table header doesn't scale down the same way that the content does (header is wider than content). Is there any way to attach jScrollPane to jQuery Datatables to scroll header and body equally? I mean something like:
$('#blabla').find('.dataTables_scrollBody').jScrollPane();
but for scrollBody AND scrollHead. Or is there any way for initializing scrollable Datatable without division to separate header and body?
Thanks!