FixedHeader using .width() instead of .outerWidth() to assign column widths
FixedHeader using .width() instead of .outerWidth() to assign column widths

I have a problem with the way FixedHeader clones a header.
In our css we define a style for elements assigning some padding, like:
[code]
.th_padding {
padding-left: 5px;
}
[/code]
The problem is that the function _fnCloneThead uses jQuery's .width() function when reading the width of the original th's. The .width() function does not take into account a possible padding on the element, and thus the resulting cloned header's th elements have a smaller width than the original.
This is the problematic code:
[code]
/* Copy the widths across - apparently a clone isn't good enough for this */
jQuery("thead:eq(0)>tr th", s.nTable).each( function (i) {
jQuery("thead:eq(0)>tr th:eq("+i+")", nTable).width( jQuery(this).width() );
} );
jQuery("thead:eq(0)>tr td", s.nTable).each( function (i) {
jQuery("thead:eq(0)>tr th:eq("+i+")", nTable)[0].style.width( jQuery(this).width() );
} );
[/code]
I think this should be changed to take into account a possible padding on the cells using .outerWidth().
In our css we define a style for elements assigning some padding, like:
[code]
.th_padding {
padding-left: 5px;
}
[/code]
The problem is that the function _fnCloneThead uses jQuery's .width() function when reading the width of the original th's. The .width() function does not take into account a possible padding on the element, and thus the resulting cloned header's th elements have a smaller width than the original.
This is the problematic code:
[code]
/* Copy the widths across - apparently a clone isn't good enough for this */
jQuery("thead:eq(0)>tr th", s.nTable).each( function (i) {
jQuery("thead:eq(0)>tr th:eq("+i+")", nTable).width( jQuery(this).width() );
} );
jQuery("thead:eq(0)>tr td", s.nTable).each( function (i) {
jQuery("thead:eq(0)>tr th:eq("+i+")", nTable)[0].style.width( jQuery(this).width() );
} );
[/code]
I think this should be changed to take into account a possible padding on the cells using .outerWidth().
This discussion has been closed.
Replies