Refresh table header on each re-init ("setup")

master
Vitaliy Filippov 2016-03-04 15:33:44 +03:00
parent c5ee9a311c
commit 384bd78c4c
2 changed files with 14 additions and 12 deletions

View File

@ -2,6 +2,7 @@
* jquery.fixedHeaderTable. The jQuery fixedHeaderTable plugin * jquery.fixedHeaderTable. The jQuery fixedHeaderTable plugin
* *
* Copyright (c) 2013 Mark Malek * Copyright (c) 2013 Mark Malek
* (c) 2015-2016 Vitaliy Filippov
* http://fixedheadertable.com * http://fixedheadertable.com
* *
* Licensed under MIT * Licensed under MIT
@ -10,10 +11,8 @@
* http://docs.jquery.com/Plugins/Authoring * http://docs.jquery.com/Plugins/Authoring
* jQuery authoring guidelines * jQuery authoring guidelines
* *
* Launch : October 2009 * Version: 2016-03-04
* Version : 1.3 * Based on: Original 1.3 (2011-05-09)
* Released: May 9th, 2011
*
* *
* all CSS sizing (width,height) is done in pixels (px) * all CSS sizing (width,height) is done in pixels (px)
*/ */
@ -140,6 +139,10 @@
$thead.clone().appendTo($divHead.find('table')); $thead.clone().appendTo($divHead.find('table'));
} else { } else {
$divHead = $wrapper.find('div.fht-thead'); $divHead = $wrapper.find('div.fht-thead');
// Refresh header (it may have changed in between)
$divHead.find('thead').remove();
$thead.clone().appendTo($divHead.find('table'));
} }
$divHead.find('table.fht-table') $divHead.find('table.fht-table')
.css({ width: widthWithScrollbar }); .css({ width: widthWithScrollbar });
@ -178,7 +181,7 @@
}); });
if (settings.autoResize && !$self.hasClass('fht-table-init')) { if (settings.autoResize && !$self.hasClass('fht-table-init')) {
$(window).resize(function() { $(window).on('resize', function() {
$wrapper.find('.fht-cell').remove(); $wrapper.find('.fht-cell').remove();
$self.fixedHeaderTable(); $self.fixedHeaderTable();
methods.resize.apply(self); methods.resize.apply(self);

File diff suppressed because one or more lines are too long