I have a table with 100 columns. I'm running a loop through all the th elements, to explicitly set the width of each th.
var $ths = $("table th");
$ths.each(function (i, th) {
var $th = $(th);
var width = $th.width();
$th.width(width);
});
For 100 columns, this takes too much amount of time (more than 60s). Each "get width" call takes 500-700 ms. This is because it needs to generate layout every time, I get width.
Question - Is there a faster way to get width?
Reason - I'm freezing header. For that I need to set width of each header to fixed pixel width. Everything is dynamic and pre-setting the width of each column in px is not an option.