Only visible columns will be considered when fixing column widths. Fixes #371

This commit is contained in:
Mottie 2013-10-09 20:54:46 -05:00
parent 4bcf3b9003
commit 636ef9c65a

View File

@ -497,7 +497,8 @@
if (table.config.widthFixed && $(table).find('colgroup').length === 0) { if (table.config.widthFixed && $(table).find('colgroup').length === 0) {
var colgroup = $('<colgroup>'), var colgroup = $('<colgroup>'),
overallWidth = $(table).width(); overallWidth = $(table).width();
$(table.tBodies[0]).find("tr:first").children("td").each(function() { // only add col for visible columns - fixes #371
$(table.tBodies[0]).find("tr:first").children("td:visible").each(function() {
colgroup.append($('<col>').css('width', parseInt(($(this).width()/overallWidth)*1000, 10)/10 + '%')); colgroup.append($('<col>').css('width', parseInt(($(this).width()/overallWidth)*1000, 10)/10 + '%'));
}); });
$(table).prepend(colgroup); $(table).prepend(colgroup);