I have implemented my own fixed header table using simple JS logic (Can't use Pure CSS due to some restrictions):
Created two tables. One for header (It will not have scrollbar)
and one for table body(It have overflow as auto)
I have not mentioned width of columns explicitly as i wanted to have dynamic column width as per data.
I'm getting column's width by using following code:
var col1 = document.getElementById("column1").offsetWidth;
And applying this width to header columns.
But when a scrollbar appears to a table(As table is of fixed height) then the offsetWidth returns different value than actual, and misalignment happens with header and body.
I tried parentWidth also. But again getting not getting width correctly.
Is there any way to get width of columns correctly when scroll appears ?