New features:

Added side scrolling for tables that exceed wrapper width.

Signed-off-by: Mark Malek <markmmalek@me.com>
master
Mark Malek 2011-05-07 23:37:50 -04:00
parent 891d3086cd
commit cff9699e3e
2 changed files with 29 additions and 3 deletions

View File

@ -39,12 +39,12 @@
/* @group Content */
div.fht-table-wrapper {
overflow: hidden;
}
div.fht-tbody {
overflow-y: auto;
overflow-x: hidden;
overflow-x: auto;
}
.fht-table .fht-cell {

View File

@ -165,6 +165,8 @@
.addClass(settings.altClass);
}
helpers._bindScroll( $divBody );
return self;
},
@ -294,6 +296,30 @@
},
/*
* return void
* bind scroll event
*/
_bindScroll: function( $obj ) {
var $self = $obj,
$thead = $self.siblings('.fht-thead'),
$tfoot = $self.siblings('.fht-tfoot');
$self.bind('scroll', function() {
$thead.find('table')
.css({
'margin-left': -this.scrollLeft
});
if ( settings.cloneHeadToFoot ) {
$tfoot.find('table')
.css({
'margin-left': -this.scrollLeft
});
}
});
},
/*
* return void
*/
@ -411,7 +437,7 @@
.css({ position: 'absolute', top: -1000, left: -1000 }).appendTo('body'),
$textarea2 = $('<textarea cols="10" rows="2" style="overflow: hidden;"></textarea>')
.css({ position: 'absolute', top: -1000, left: -1000 }).appendTo('body');
scrollbarWidth = $textarea1.width() - $textarea2.width();
scrollbarWidth = $textarea1.width() - $textarea2.width() + 2; // + 2 for border offset
$textarea1.add($textarea2).remove();
} else {
var $div = $('<div />')