Sunday, 8 September 2013

Fast way to align row heights in 2 different tables

Fast way to align row heights in 2 different tables

Currently using this javascript function to align all the rows by matching
their heights in 2 different tables. Each table has more than 1000 rows.
And this function takes greater than 4 seconds to execute. Is there a
faster way to match two different tables' row heights? Thanks
function alignTableRowHeights() {
$('#table1 tr').each(function(i) {
var rowDisplay=$(this).css("display")
if(rowDisplay!="none"){
// Row is visible
var tableTwoRow = $('#table2 tr').get(i);
var height = $(tableTwoRow).height();
$(this).height(height);
}
});
}

No comments:

Post a Comment