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

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

erubioerubio Posts: 1Questions: 0Answers: 0
edited May 2011 in Bug reports
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().

Replies

  • ddwagddwag Posts: 0Questions: 0Answers: 0
    This bug living a present. Just replace jQuery(this).width() with jQuery(this).innerWidth().
This discussion has been closed.