mirror of
https://github.com/Mottie/tablesorter.git
synced 2024-11-15 23:54:22 +00:00
parent
8cd27bb65f
commit
ba7a0de1b8
@ -87,6 +87,8 @@ ts.addWidget({
|
|||||||
$win.bind('resize', ts.window_resize);
|
$win.bind('resize', ts.window_resize);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
// required css definition
|
||||||
|
$('body').append('<style>.ts-scroller-reset { width: auto !important; }</style>');
|
||||||
},
|
},
|
||||||
format: function(table, c, wo) {
|
format: function(table, c, wo) {
|
||||||
var h, $hdr, id, t, resize, $cells,
|
var h, $hdr, id, t, resize, $cells,
|
||||||
@ -120,43 +122,44 @@ ts.addWidget({
|
|||||||
}
|
}
|
||||||
|
|
||||||
resize = function(){
|
resize = function(){
|
||||||
var d,
|
var d, b,
|
||||||
//Hide other scrollers so we can resize
|
//Hide other scrollers so we can resize
|
||||||
$div = $('div.scroller[id != "' + id + '"]').hide();
|
$div = $('div.scroller[id != "' + id + '"]').hide();
|
||||||
|
|
||||||
$tbl.find('thead').show();
|
$tbl.find('thead').show();
|
||||||
|
|
||||||
//Reset sizes so parent can resize.
|
//Reset sizes so parent can resize.
|
||||||
$hdr
|
|
||||||
.width(0)
|
|
||||||
.parent().width(0)
|
|
||||||
.find('th,td').width(0);
|
|
||||||
|
|
||||||
$tbl
|
$tbl
|
||||||
.width(0)
|
.addClass('ts-scroller-reset')
|
||||||
.find('thead').find('th,td').width(0);
|
.find('thead').find('.tablesorter-header-inner').addClass('ts-scroller-reset');
|
||||||
d = $tbl.parent();
|
d = $tbl.parent();
|
||||||
d.width(0);
|
d.addClass('ts-scroller-reset');
|
||||||
|
|
||||||
d.parent().trigger('resize');
|
d.parent().trigger('resize');
|
||||||
// Shrink a bit to accommodate scrollbar
|
// Shrink a bit to accommodate scrollbar
|
||||||
d.width( d.parent().innerWidth() - ( d.parent().hasScrollBar() ? wo.scroller_barWidth : 0 ) );
|
d.width( d.parent().innerWidth() - ( d.parent().hasScrollBar() ? wo.scroller_barWidth : 0 ) );
|
||||||
|
|
||||||
$tbl.width( d.innerWidth() - ( d.hasScrollBar() ? wo.scroller_barWidth : 0 ) );
|
$tbl.width( d.innerWidth() - ( d.hasScrollBar() ? wo.scroller_barWidth : 0 ) );
|
||||||
|
|
||||||
|
$tbl.parent().find('.ts-scroller-reset').removeClass('ts-scroller-reset');
|
||||||
|
|
||||||
|
b = parseInt( $tbl.css('border-left-width'), 10 ) + parseInt( $tbl.css('border-right-width'), 10 );
|
||||||
|
|
||||||
$tbl.find('thead').find('th,td').filter(':visible').each(function(i, c){
|
$tbl.find('thead').find('th,td').filter(':visible').each(function(i, c){
|
||||||
var $th = $(c),
|
var $th = $(c).find('.tablesorter-header-inner'),
|
||||||
//Wrap in browser detect??
|
// wrap in browser detect??
|
||||||
w = parseInt( $th.css('min-width').replace('auto', '0').replace(/(px|em)/, ''), 10 );
|
w = parseInt( $th.css('min-width').replace('auto', '0').replace(/(px|em)/, ''), 10 );
|
||||||
if ( $th.width() < w ) {
|
if ( $th.width() < w ) {
|
||||||
$th.width(w);
|
$th.width(w);
|
||||||
} else {
|
} else {
|
||||||
w = $th.width();
|
w = $th.width();
|
||||||
}
|
}
|
||||||
$hdr.find('th,td').eq(i).width(w);
|
$hdr.find('th,td').filter(':visible').eq(i).find('.tablesorter-header-inner').width(w - b);
|
||||||
});
|
});
|
||||||
|
|
||||||
$hdr.width($tbl.innerWidth());
|
$hdr.width($tbl.innerWidth());
|
||||||
$hdr.parent().width($tbl.innerWidth());
|
$hdr.parent().width($tbl.innerWidth());
|
||||||
|
|
||||||
$div.show();
|
$div.show();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user