revert code that always adds a colgroup - fixes issue #238

This commit is contained in:
Mottie 2013-02-14 11:37:01 -06:00
parent 51745e904d
commit f6185db9ac

View File

@ -449,23 +449,13 @@
// automatically add col group, and column sizes if set // automatically add col group, and column sizes if set
function fixColumnWidth(table) { function fixColumnWidth(table) {
var $c, c = table.config, if (table.config.widthFixed && $(table).find('colgroup').length === 0) {
$cg = $('<colgroup>'), var colgroup = $('<colgroup>'),
$cgo = c.$table.find('colgroup'), overallWidth = $(table).width();
n = c.columns.length, $("tr:first td", table.tBodies[0]).each(function() {
overallWidth = c.$table.width(); colgroup.append($('<col>').css('width', parseInt(($(this).width()/overallWidth)*1000, 10)/10 + '%'));
$("tr:first td", table.tBodies[0]).each(function(i) { });
$c = $('<col>'); $(table).prepend(colgroup);
if (c.widthFixed) {
$c.css('width', parseInt(($(this).width()/overallWidth)*1000, 10)/10 + '%');
}
$cg.append($c);
});
// replace colgroup contents
if ($cgo.length) {
$cgo.html( $cg.html() );
} else {
c.$table.prepend( $cg );
} }
} }