I have 2 tables: table1 ("header table", which has only 1 row with table columns) - and table2 ("data table", which has several rows with all the data).
table1 has the widths assigned to most columns. Now I'm trying to apply the column width from table1 to the first row of table2 (table1 has the same width as table2).
My code is:
var tr1 = $("tr",tblHeader).eq(0);
var tr2 = $("tr",tblData).eq(0);
var td2 = $("td",tr2);
$('td',tr1).each(function(i)
{
var td1 = $(this);
var width = (td1.css('width'));
td1.css('width',width+"px");
td2.eq(i).css('width',wi+"px");
});
Problem:
when installing td-padding in my css, for example: table td{padding:0px;}everything works fine (both tables have the same column widths). but as soon as I change the overlay to something like table td {padding:2px;padding-left:4px;padding-right:4px;}, the data table spins. When checking column widths with firebug, all columns have the same width (table1 + table2), but they still look different. Any ideas what could be wrong?
source
share