DataTables / FixedHeader

Fix the header, footer, left or right columns of a table in place, to always show them when scrolling
http://www.datatables.net/
Other
75 stars 83 forks source link

Allow to trust CSS for thead elements sizes #2

Closed evax closed 12 years ago

evax commented 12 years ago

Using FixedHeader (without DataTables, and only for thead) it appears the width computation of the overlay table elements is very often off by a few pixels (verified on Chrome/FF).

The quick fix in my case is to trust CSS for the width:

diff --git a/js/FixedHeader.js b/js/FixedHeader.js
index 7ec45d6..115abd9 100644
--- a/js/FixedHeader.js
+++ b/js/FixedHeader.js
@@ -674,6 +674,7 @@ FixedHeader.prototype = {
                nTable.appendChild( nThead );

                /* Copy the widths across - apparently a clone isn't good enough for this */
+               /*
                jQuery("thead>tr th", s.nTable).each( function (i) {
                        jQuery("thead>tr th:eq("+i+")", nTable).width( jQuery(this).width() );
                } );
@@ -681,6 +682,7 @@ FixedHeader.prototype = {
                jQuery("thead>tr td", s.nTable).each( function (i) {
                        jQuery("thead>tr td:eq("+i+")", nTable).width( jQuery(this).width() );
                } );
+               */
        },

        /*

It would be nice to have such a "trust CSS" init option.

DataTables commented 12 years ago

That's certainly possible, but it would be nice to know why this code isn't working correctly. Sounds like this needs a bit more investigation to understand why it happens (column width matching across browsers is such a painful exercise!).

evax commented 12 years ago

Sorry about the long delay, I updated to 2.0.6 and the issue disappeared, so I'm closing this.